<#import "/spring.ftl" as spring>

App.loadNavMenu({
    "items" : [
        <#if SecurityUtils.isGrantedAny("SUPERUSER","CUSTOMER_MAINTAIN")>
        {
            text: "Customer",
            title: "Customer",
            iconCls: "x-fa fa-user-circle-o",
            viewType: "customerContainer",
            leaf: true,
        },
        </#if>
        <#if SecurityUtils.isGrantedAny("SUPERUSER","CALENDAR_VIEW")>
        {
            text: "Calendar",
            title:"Calendar",
            iconCls: "x-fa fa-calendar",
            viewType: "calendarContainer",
            leaf: true,
        },
        </#if>
        <#if SecurityUtils.isGrantedAny("SUPERUSER","ORDER_MAINTAIN")>
        {
            text: "Order",
            title: "Order",
            // text: App.localeRes("Message"),
            iconCls: "x- fa fa-file-text",
            viewType: "orderContainer",
            leaf: true,
        },
        </#if>
        <#if SecurityUtils.isGrantedAny("SUPERUSER","WORKSHOP_MAINTAIN")>
        {
            text: 'Workshop',
            title: "Workshop",
            iconCls: "x-fa fa-cut",
            viewType: "workshopContainer",
            leaf: true,
    
        },
        </#if>
        <#if SecurityUtils.isGrantedAny("SUPERUSER","PRICE_LIST_VIEW","PRICE_LIST_MAINTAIN")>
        {
            text: 'Price List',
            title: "Price List",
            iconCls: "x-fa fa-sitemap",
            viewType: 'materialContainer',
            leaf: true,
        },
        </#if>
        {
            text: "Report",
            iconCls: "x-fa fa-sticky-note",
            expanded: false,
            selectable: false,
            children: [
                <#if SecurityUtils.isGrantedAny("SUPERUSER","PAYMENT_REPORT")>
                {
                    text: 'Payment Report',
                    title: 'Payment Report',
                    viewType: "report_PaymentContainer",
                    iconCls: "x-fa fa-file-excel-o",
                    leaf: true,
                },
                </#if>
                {
                    text: 'Orders Report',
                    title: 'Orders Report',
                    viewType: "report_OrderContainer",
                    iconCls: "x-fa fa-file-excel-o",
                    leaf: true
                },
                {
                    text: 'Outstanding Report',
                    title: 'Outstanding Report',
                    viewType: "report_OutstandingContainer",
                    iconCls: "x-fa fa-file-excel-o",
                    leaf: true
                },
                {
                    text: 'Customer Report',
                    title: 'Customer Report',
                    viewType: "report_CustomerContainer",
                    iconCls: "x-fa fa-file-excel-o",
                    leaf: true
                },
            ]
        },
        {
            text: "Settings",
            iconCls: "x-fa fa-cogs",
            expanded: false,
            selectable: false,
            visible: App.isGranted(["USER_MAINTAIN"]),
            children: [
                /*
                {
                    text: '<span title="System Settings">System Settings</span>',
                    title: "System Settings",
                    iconCls: "x-fa fa-cogs",
                    viewType: "settingContainer",
                    leaf: true
                },
                */
                {
                    text: 'User Setting',
                    title: "User Setting",
                    iconCls: "fas fa-users",
                    viewType: "userBaseContainer",
                    visible: App.isGranted(App.getPanelAuths("userBaseContainer")),
                    leaf: true
                },
                {
                    text: 'Mail Settings',
                    title: "Mail Settings",
                    iconCls: "fas fa-mail-bulk",
                    viewType: "invoiceTemplateContainer",
                    visible: App.isGranted(App.getPanelAuths("invoiceTemplateContainer")),
                    leaf: true
                },
                <#if SecurityUtils.isGrantedOnly("2FI_ADMIN")>
                {
                    text: 'System Settings',
                    title: "System Settings",
                    iconCls: "x-fa fa-cogs",
                    viewType: "systemGroupContainer",
                    leaf: true
                }
                </#if>
            ]
        }
    ]
});
