mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
pushing for now, needs validation work
This commit is contained in:
parent
8b9aea8874
commit
52dc99588e
|
@ -49,6 +49,10 @@ class BulkAssetsController extends Controller
|
||||||
})->get();
|
})->get();
|
||||||
|
|
||||||
$models = $asset_custom_field->unique('model_id');
|
$models = $asset_custom_field->unique('model_id');
|
||||||
|
$modelNames = [];
|
||||||
|
foreach($models as $model) {
|
||||||
|
$modelNames[] = $model->name;
|
||||||
|
}
|
||||||
|
|
||||||
ray($asset_custom_field);
|
ray($asset_custom_field);
|
||||||
ray($models);
|
ray($models);
|
||||||
|
@ -78,7 +82,8 @@ class BulkAssetsController extends Controller
|
||||||
->with('assets', $asset_ids)
|
->with('assets', $asset_ids)
|
||||||
->with('statuslabel_list', Helper::statusLabelList())
|
->with('statuslabel_list', Helper::statusLabelList())
|
||||||
// ->with('custom_fields', $custom_fields)
|
// ->with('custom_fields', $custom_fields)
|
||||||
->with('models', $models->pluck('model'));
|
->with('models', $models->pluck('model'))
|
||||||
|
->with('modelNames', $modelNames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,8 +181,6 @@ class CustomField extends Model
|
||||||
public function assetModels()
|
public function assetModels()
|
||||||
{
|
{
|
||||||
return $this->fieldset()->with('models')->get()->pluck('models')->flatten()->unique('id');
|
return $this->fieldset()->with('models')->get()->pluck('models')->flatten()->unique('id');
|
||||||
|
|
||||||
// return $this->models->where(, AssetModel::class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
@php
|
@php
|
||||||
|
//set array up before loop so it doesn't get wiped at every iteration
|
||||||
$fields = [];
|
$fields = [];
|
||||||
$modelNames = [];
|
|
||||||
foreach($models as $model) {
|
|
||||||
$modelNames[] = $model->name;
|
|
||||||
}
|
|
||||||
@endphp
|
@endphp
|
||||||
@foreach($models as $model)
|
@foreach($models as $model)
|
||||||
@if (($model) && ($model->fieldset))
|
@if (($model) && ($model->fieldset))
|
||||||
@foreach($model->fieldset->fields AS $field)
|
@foreach($model->fieldset->fields AS $field)
|
||||||
|
@php
|
||||||
@php
|
//prevents some duplicate queries - open to a better way of skipping dupes in output
|
||||||
if (in_array($field->db_column_name(), $fields)) {
|
//its ugly, but if we'd rather deal with duplicate queries we can get rid of this.
|
||||||
$duplicate = true;
|
if (in_array($field->db_column_name(), $fields)) {
|
||||||
continue;
|
$duplicate = true;
|
||||||
} else {
|
continue;
|
||||||
$duplicate = false;
|
} else {
|
||||||
}
|
$duplicate = false;
|
||||||
$fields[] = $field->db_column_name();
|
}
|
||||||
@endphp
|
$fields[] = $field->db_column_name();
|
||||||
|
@endphp
|
||||||
|
|
||||||
<div class="form-group{{ $errors->has($field->db_column_name()) ? ' has-error' : '' }}">
|
<div class="form-group{{ $errors->has($field->db_column_name()) ? ' has-error' : '' }}">
|
||||||
<label for="{{ $field->db_column_name() }}" class="col-md-3 control-label">{{ $field->name }} </label>
|
<label for="{{ $field->db_column_name() }}" class="col-md-3 control-label">{{ $field->name }} </label>
|
||||||
|
|
Loading…
Reference in a new issue