pushing for now, needs validation work

This commit is contained in:
slong753 2023-04-17 13:57:48 -05:00
parent 8b9aea8874
commit 52dc99588e
3 changed files with 18 additions and 17 deletions

View file

@ -49,6 +49,10 @@ class BulkAssetsController extends Controller
})->get();
$models = $asset_custom_field->unique('model_id');
$modelNames = [];
foreach($models as $model) {
$modelNames[] = $model->name;
}
ray($asset_custom_field);
ray($models);
@ -78,7 +82,8 @@ class BulkAssetsController extends Controller
->with('assets', $asset_ids)
->with('statuslabel_list', Helper::statusLabelList())
// ->with('custom_fields', $custom_fields)
->with('models', $models->pluck('model'));
->with('models', $models->pluck('model'))
->with('modelNames', $modelNames);
}
}

View file

@ -181,8 +181,6 @@ class CustomField extends Model
public function assetModels()
{
return $this->fieldset()->with('models')->get()->pluck('models')->flatten()->unique('id');
// return $this->models->where(, AssetModel::class);
}
/**

View file

@ -1,23 +1,21 @@
@php
//set array up before loop so it doesn't get wiped at every iteration
$fields = [];
$modelNames = [];
foreach($models as $model) {
$modelNames[] = $model->name;
}
@endphp
@foreach($models as $model)
@if (($model) && ($model->fieldset))
@foreach($model->fieldset->fields AS $field)
@php
if (in_array($field->db_column_name(), $fields)) {
$duplicate = true;
continue;
} else {
$duplicate = false;
}
$fields[] = $field->db_column_name();
@endphp
@php
//prevents some duplicate queries - open to a better way of skipping dupes in output
//its ugly, but if we'd rather deal with duplicate queries we can get rid of this.
if (in_array($field->db_column_name(), $fields)) {
$duplicate = true;
continue;
} else {
$duplicate = false;
}
$fields[] = $field->db_column_name();
@endphp
<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>