quick category changes..
This commit is contained in:
parent
f57171c562
commit
3b4dbf3ee5
@ -31,18 +31,14 @@ class Categories extends Controller
|
||||
{
|
||||
$type = $request->get('type', 'item');
|
||||
|
||||
$categories = [];
|
||||
$categories = collect();
|
||||
|
||||
foreach (config('type.category') as $type => $config) {
|
||||
$categories[$type] = [];
|
||||
}
|
||||
|
||||
Category::enabled()->orderBy('name')->get()->each(function ($category) use (&$categories) {
|
||||
$categories[$category->type][] = [
|
||||
Category::type($type)->enabled()->orderBy('name')->get()->each(function ($category) use (&$categories) {
|
||||
$categories->push([
|
||||
'id' => $category->id,
|
||||
'title' => $category->name,
|
||||
'level' => $category->level,
|
||||
];
|
||||
]);
|
||||
});
|
||||
|
||||
$html = view('modals.categories.create', compact('type', 'categories'))->render();
|
||||
|
@ -228,8 +228,6 @@ export default {
|
||||
'#efef32'
|
||||
],
|
||||
min_date: false,
|
||||
categoriesBasedTypes: null,
|
||||
isParentCategoryDisabled: true,
|
||||
}
|
||||
},
|
||||
|
||||
@ -290,28 +288,6 @@ export default {
|
||||
.catch(error => {
|
||||
});
|
||||
},
|
||||
|
||||
updateParentCategories(event) {
|
||||
if (event === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof JSON.parse(this.form.categories)[event] === 'undefined') {
|
||||
this.categoriesBasedTypes = [];
|
||||
this.isParentCategoryDisabled = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.form.parent_category_id) {
|
||||
this.form.parent_category_id = null;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.categoriesBasedTypes = JSON.parse(this.form.categories)[event];
|
||||
this.isParentCategoryDisabled = false;
|
||||
},
|
||||
}
|
||||
})
|
||||
});
|
||||
|
@ -4,9 +4,7 @@
|
||||
|
||||
<x-form.group.color name="color" label="{{ trans('general.color') }}" form-group-class="col-span-6" />
|
||||
|
||||
<x-form.group.select name="parent_id" label="{{ trans('general.parent') . ' ' . trans_choice('general.categories', 1) }}" :options="[]" not-required focus="updateParentCategories(form.type)" dynamicOptions="categoriesBasedTypes" sort-options="false" v-disabled="isParentCategoryDisabled" form-group-class="col-span-6" />
|
||||
|
||||
<x-form.input.hidden name="categories" value="{{ json_encode($categories) }}" />
|
||||
<x-form.group.select name="parent_id" label="{{ trans('general.parent') . ' ' . trans_choice('general.categories', 1) }}" :options="$categories" not-required sort-options="false" searchable form-group-class="col-span-6" />
|
||||
|
||||
<x-form.input.hidden name="type" :value="'{{ $type }}'" @change="updateParentCategories" />
|
||||
<x-form.input.hidden name="enabled" value="1" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user