mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Show checkboxes a little less assy, actually save the data checked by them
This commit is contained in:
parent
796a0ebdaa
commit
2f3499e4b9
|
@ -168,7 +168,6 @@ class AssetModelsController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if ($model->save()) {
|
||||
return redirect()->route("models.index")->with('success', trans('admin/models/message.update.success'));
|
||||
}
|
||||
|
@ -463,6 +462,9 @@ class AssetModelsController extends Controller
|
|||
private function assignCustomFieldsDefaultValues(AssetModel $model, array $defaultValues)
|
||||
{
|
||||
foreach ($defaultValues as $customFieldId => $defaultValue) {
|
||||
if(is_array($defaultValue)){
|
||||
$model->defaultValues()->attach($customFieldId, ['default_value' => implode(',', $defaultValue)]);
|
||||
}
|
||||
if ($defaultValue) {
|
||||
$model->defaultValues()->attach($customFieldId, ['default_value' => $defaultValue]);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,10 @@
|
|||
<div class="col-sm-12 col-lg-6">
|
||||
<input v-if="field.type == 'text'" class="form-control m-b-xs" type="text" :value="getValue(field)" :id="'default-value' + field.id" :name="'default_values[' + field.id + ']'">
|
||||
<textarea v-if="field.type == 'textarea'" class="form-control" :value="getValue(field)" :id="'default-value' + field.id" :name="'default_values[' + field.id + ']'"></textarea><br>
|
||||
<input v-if="field.type == 'checkbox'" v-for="field_value in field.field_values_array" class="" type="checkbox" :value="field_value">
|
||||
|
||||
<div v-for="field_value in field.field_values_array">
|
||||
<input v-if="field.type == 'checkbox'" class="" type="checkbox" :name="'default_values[' + field.id + '][]'" :value="field_value"> <label>{{ field_value }}</label>
|
||||
</div>
|
||||
|
||||
<select v-if="field.type == 'listbox'" class="form-control m-b-xs" :name="'default_values[' + field.id + ']'">
|
||||
<option value=""></option>
|
||||
|
|
Loading…
Reference in a new issue