mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Merge pull request #4 from snipe/develop
Merge current develop into branch
This commit is contained in:
commit
7084703b5a
|
@ -19,13 +19,22 @@ class CustomFieldSetDefaultValuesForModel extends Component
|
|||
{
|
||||
$this->model = AssetModel::find($this->model_id); // It's possible to do some clever route-model binding here, but let's keep it simple, shall we?
|
||||
$this->fieldset_id = $this->model->fieldset_id;
|
||||
$this->fields = CustomFieldset::find($this->fieldset_id)->fields;
|
||||
$this->add_default_values = ( $this->model->defaultValues->count() > 0);
|
||||
|
||||
$this->fields = null;
|
||||
|
||||
if ($fieldset = CustomFieldset::find($this->fieldset_id)) {
|
||||
$this->fields = CustomFieldset::find($this->fieldset_id)->fields;
|
||||
}
|
||||
|
||||
$this->add_default_values = ($this->model->defaultValues->count() > 0);
|
||||
}
|
||||
|
||||
public function updatedFieldsetId()
|
||||
{
|
||||
$this->fields = CustomFieldset::find($this->fieldset_id)->fields;
|
||||
if (CustomFieldset::find($this->fieldset_id)) {
|
||||
$this->fields = CustomFieldset::find($this->fieldset_id)->fields;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
|
|
@ -12,9 +12,10 @@
|
|||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@if( $this->add_default_values ) {{-- 'if the checkbox is enabled *AND* there are more than 0 fields in the fieldsset' --}}
|
||||
@if ($this->add_default_values ) {{-- 'if the checkbox is enabled *AND* there are more than 0 fields in the fieldsset' --}}
|
||||
<div>
|
||||
<div class="form-group">
|
||||
@if ($fields)
|
||||
@foreach ($fields as $field)
|
||||
<div class="form-group">
|
||||
|
||||
|
@ -49,6 +50,7 @@
|
|||
</div>
|
||||
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue