close #2552 Added: Quick category modal add parent category field
This commit is contained in:
@ -228,6 +228,8 @@ export default {
|
||||
'#efef32'
|
||||
],
|
||||
min_date: false,
|
||||
categoriesBasedTypes: null,
|
||||
isParentCategoryDisabled: true,
|
||||
}
|
||||
},
|
||||
|
||||
@ -288,6 +290,28 @@ 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;
|
||||
},
|
||||
}
|
||||
})
|
||||
});
|
||||
|
@ -125,6 +125,10 @@
|
||||
@change="{{ $attributes['change'] }}($event)"
|
||||
@endif
|
||||
|
||||
@if (! empty($attributes['focus']))
|
||||
@focus="{{ $attributes['focus'] }}"
|
||||
@endif
|
||||
|
||||
@if (! empty($attributes['visible-change']))
|
||||
@visible-change="{{ $attributes['visible-change'] }}"
|
||||
@endif
|
||||
|
@ -4,7 +4,11 @@
|
||||
|
||||
<x-form.group.color name="color" label="{{ trans('general.color') }}" form-group-class="col-span-6" />
|
||||
|
||||
<x-form.input.hidden name="type" :value="$type" />
|
||||
<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" disabled="isParentCategoryDisabled" form-group-class="col-span-6" />
|
||||
|
||||
<x-form.input.hidden name="categories" value="{{ json_encode($categories) }}" />
|
||||
|
||||
<x-form.input.hidden name="type" :value="'{{ $type }}'" @change="updateParentCategories" />
|
||||
<x-form.input.hidden name="enabled" value="1" />
|
||||
</div>
|
||||
</x-form>
|
||||
|
Reference in New Issue
Block a user