feat: Add menu icon support in menu management
- Enhanced the menu management functionality by adding a new `menu_icon` field in the database schema, allowing for the storage of menu icons. - Updated the `saveMenu` and `updateMenu` functions in the admin controller to handle the new `menu_icon` field during menu creation and updates. - Modified the `AdminService` to include `MENU_ICON` in various queries, ensuring that the icon data is retrieved and processed correctly. - Integrated the `MenuIconPicker` component in the frontend to allow users to select and display menu icons in the `MenuFormModal`. - Updated the sidebar and layout components to utilize the new icon data, enhancing the visual representation of menus across the application.
This commit is contained in:
@@ -20,6 +20,7 @@ import { toast } from "sonner";
|
||||
import { ChevronDown, Search } from "lucide-react";
|
||||
import { MENU_MANAGEMENT_KEYS } from "@/lib/utils/multilang";
|
||||
import { ScreenDefinition } from "@/types/screen";
|
||||
import { MenuIconPicker } from "./MenuIconPicker";
|
||||
|
||||
interface Company {
|
||||
company_code: string;
|
||||
@@ -77,6 +78,7 @@ export const MenuFormModal: React.FC<MenuFormModalProps> = ({
|
||||
status: "ACTIVE",
|
||||
companyCode: parentCompanyCode || "none",
|
||||
langKey: "",
|
||||
menuIcon: "",
|
||||
});
|
||||
|
||||
// 화면 할당 관련 상태
|
||||
@@ -275,6 +277,7 @@ export const MenuFormModal: React.FC<MenuFormModalProps> = ({
|
||||
const status = menu.status || menu.STATUS || "active";
|
||||
const companyCode = menu.company_code || menu.COMPANY_CODE || "";
|
||||
const langKey = menu.lang_key || menu.LANG_KEY || "";
|
||||
const menuIcon = menu.menu_icon || menu.MENU_ICON || "";
|
||||
|
||||
// 메뉴 타입 변환 (admin/user -> 0/1)
|
||||
let convertedMenuType = menuType;
|
||||
@@ -307,7 +310,8 @@ export const MenuFormModal: React.FC<MenuFormModalProps> = ({
|
||||
menuType: convertedMenuType,
|
||||
status: convertedStatus,
|
||||
companyCode: companyCode,
|
||||
langKey: langKey, // 다국어 키 설정
|
||||
langKey: langKey,
|
||||
menuIcon: menuIcon,
|
||||
});
|
||||
|
||||
// URL 타입 설정
|
||||
@@ -420,9 +424,10 @@ export const MenuFormModal: React.FC<MenuFormModalProps> = ({
|
||||
menuDesc: "",
|
||||
seq: 1,
|
||||
menuType: defaultMenuType,
|
||||
status: "ACTIVE", // 기본값은 활성화
|
||||
companyCode: parentCompanyCode || "none", // 상위 메뉴의 회사 코드를 기본값으로 설정
|
||||
langKey: "", // 다국어 키 초기화
|
||||
status: "ACTIVE",
|
||||
companyCode: parentCompanyCode || "none",
|
||||
langKey: "",
|
||||
menuIcon: "",
|
||||
});
|
||||
|
||||
// console.log("메뉴 등록 기본값 설정:", {
|
||||
@@ -839,6 +844,11 @@ export const MenuFormModal: React.FC<MenuFormModalProps> = ({
|
||||
/>
|
||||
</div>
|
||||
|
||||
<MenuIconPicker
|
||||
value={formData.menuIcon || ""}
|
||||
onChange={(iconName) => handleInputChange("menuIcon", iconName)}
|
||||
/>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="menuUrl">{getText(MENU_MANAGEMENT_KEYS.FORM_MENU_URL)}</Label>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user