Skip to content

Commit 1485fe3

Browse files
committed
Added menu icon path add/edit on menu items
1 parent 821f0d7 commit 1485fe3

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

resources/js/Components/Admin/MenuItemList.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { Link } from "@inertiajs/vue3"
33
import BaseButton from "@/Components/BaseButton.vue"
44
import BaseButtons from "@/Components/BaseButtons.vue"
5+
import BaseIcon from '@/Components/BaseIcon.vue'
56
import {
67
mdiSquareEditOutline,
78
mdiTrashCan,
@@ -30,7 +31,17 @@ const props = defineProps({
3031
<template>
3132
<tr :key="item.id">
3233
<td data-label="Name">
33-
<div :style="{ 'margin-left': level*20 + 'px' }">{{ item.name }}</div>
34+
<div :style="{ 'margin-left': level*20 + 'px' }">
35+
<BaseIcon
36+
v-if="item.icon"
37+
:path="item.icon"
38+
class="flex-none"
39+
:class="activeInactiveStyle"
40+
w="w-16"
41+
:size="18"
42+
/>
43+
{{ item.name }}
44+
</div>
3445
</td>
3546
<td data-label="Description">
3647
{{ item.description }}

resources/js/Pages/Admin/Menu/Item/Create.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const form = useForm({
3737
enabled: true,
3838
parent_id: '',
3939
weight: '',
40+
icon: '',
4041
roles: []
4142
})
4243
@@ -152,6 +153,21 @@ const form = useForm({
152153
</div>
153154
</FormControl>
154155
</FormField>
156+
<FormField
157+
label="Icon"
158+
:class="{ 'text-red-400': form.errors.icon }"
159+
>
160+
<FormControl
161+
v-model="form.icon"
162+
type="text"
163+
placeholder="Enter Icon Path"
164+
:error="form.errors.icon"
165+
>
166+
<div class="text-red-400 text-sm" v-if="form.errors.icon">
167+
{{ form.errors.icon }}
168+
</div>
169+
</FormControl>
170+
</FormField>
155171

156172
<BaseDivider />
157173

resources/js/Pages/Admin/Menu/Item/Edit.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const form = useForm({
4747
enabled: props.item.enabled,
4848
parent_id: props.item.parent_id,
4949
weight: props.item.weight,
50+
icon: props.item.icon,
5051
roles: props.itemHasRoles
5152
})
5253
</script>
@@ -161,6 +162,21 @@ const form = useForm({
161162
</div>
162163
</FormControl>
163164
</FormField>
165+
<FormField
166+
label="Icon"
167+
:class="{ 'text-red-400': form.errors.icon }"
168+
>
169+
<FormControl
170+
v-model="form.icon"
171+
type="text"
172+
placeholder="Enter Icon Path"
173+
:error="form.errors.icon"
174+
>
175+
<div class="text-red-400 text-sm" v-if="form.errors.icon">
176+
{{ form.errors.icon }}
177+
</div>
178+
</FormControl>
179+
</FormField>
164180

165181
<BaseDivider />
166182

0 commit comments

Comments
 (0)