<script setup lang="ts">
import { ref, reactive, computed, onMounted, watch } from 'vue'
import CCGlobalNavi from '../CCGlobalNavi.vue'
import { useRoute } from 'vue-router'
import { SubjectType, SubtitleType } from '../CCGlobalNavi.types'

const path = ref('/')
const clickNav = (str: string) => {
  console.log(str)
}
const mainLogo = 'https://cdn.quasar.dev/img/parallax2.jpg'
const brokenUrl =
  // 'https://cdn.quasar.dev/img/mountains.jpg'
  'https://firebasestorage.googleapis.com/v0/b/testafterfollowconcierge.appspot.com/o/manual%2F1cOQCs73fR17lvUSumyK%2F9O7T8IGd3YX9NUWQO.png?alt=media&token=fff8d0b1-86fb-4378-bc1f-85b979dd919d'

const showFromRole = computed(() => (role: number[]) => {
  const myNumber = 5
  return role.includes(myNumber)
})

type _Subtitle = SubtitleType & { isShow: boolean; roles: number[] }
const defaultNavi: (SubjectType & {
  isShow: boolean
  roles: number[]
  subtitle: _Subtitle[]
})[] = [
  {
    title: '顧客一覧',
    isShow: true,
    roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    icon: 'folder_shared',
    path: '/customerList',
    subtitle: [
      {
        title: '顧客一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/customerList',
        infoNumber: 0,
      },
      {
        title: '物件一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/propertyList',
        infoNumber: 0,
      },
      {
        title: 'User一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/userList',
        infoNumber: 0,
      },
      {
        title: '仮登録一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        infoNumber: 0,
        path: '/preRegisterList',
      },
      {
        title: '本登録未確認一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        infoNumber: 0,
        path: '/noCheckedRegisterList',
      },
      {
        title: '今月引き渡し顧客一覧',
        isShow: true,
        // roles:[0, 1, 2, 3, 4, 5, 6, 7, 8,9,10]）
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        infoNumber: 0,
        path: '/handingOverCustomerInThisMonthList',
      },
      {
        title: 'サービス更新顧客一覧',
        isShow: true,
        // roles:[0, 1, 2, 3, 4, 5, 6, 7, 8,9,10]）
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        infoNumber: 0,
        path: '/customerUpdatedServiceList',
      },
      {
        title: '住宅設備未登録一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        infoNumber: 0,
        path: '/noInputHousingEquipmentCustomerList',
      },
      {
        title: '住宅設備変更確認',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        infoNumber: 0,
        path: '/checkForHousingEquipmentChange',
      },
      {
        title: '建物情報不足一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        infoNumber: 0,
        path: '/lackOfBuildingInformationList',
      },
      {
        title: '承認待ち顧客一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        infoNumber: 0,
        path: '/pendingApprovalCustomerList',
      },
    ],
  },
  {
    title: 'パートナー一覧',
    isShow: true,
    roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    icon: 'groups',
    path: '/partnerList',
    subtitle: [
      {
        title: 'パートナー一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/partnerList',
        infoNumber: 0,
      },
      {
        title: 'パートナー別売上一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/SalesEachPartnerList',
        infoNumber: 0,
      },
      {
        title: '予実シミュレーション',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/simulationForBudgetAndActual',
        infoNumber: 0,
      },
      {
        title: '手数料一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/feeList',
        infoNumber: 0,
      },
      {
        title: '住宅設備延長保証<br />標準設備一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/standardHousingEquipmentForWarrantyList',
        infoNumber: 0,
      },
      {
        title: 'データ登録',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/partnerDataInput',
        infoNumber: 0,
      },
      {
        title: '発注一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/orderList',
        infoNumber: 0,
      },
      {
        title: 'その他保証一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/otherWarrantyList',
        infoNumber: 0,
      },
    ],
  },
  {
    title: '代理店<br />紹介者一覧',
    isShow: true,
    roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    icon: 'domain',
    path: '/agenciesList',
    subtitle: [
      {
        title: '代理店一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/agenciesList',
        infoNumber: 0,
      },
      {
        title: '紹介者一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/introducerList',
        infoNumber: 0,
      },
    ],
  },
  {
    title: 'コンシェルジュ履歴',
    isShow: true,
    roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    icon: 'source',
    path: '/Class',
    subtitle: [
      {
        title: 'コンシェルジュ<br />履歴一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/conciergeLogList',
        infoNumber: 1,
      },
      {
        title: 'チャット一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/chatList',
        infoNumber: 1,
      },
      {
        title: '取次手数料一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/transactionFeeList',
        infoNumber: 0,
      },
      {
        title: '火災募集チャット一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/fireInsuranceChatLogList',
        infoNumber: 0,
      },
      {
        title: 'テスト表示',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/testPreview',
        infoNumber: 0,
      },
    ],
  },

  {
    title: 'ビギニング',
    isShow: true,
    roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    icon: 'contact_page',
    image: '/image/beginninglogo_wh.png',
    path: '/begninng',
    subtitle: [
      {
        title: '営業アカウント一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/beginningSalesAccounts',
        infoNumber: 0,
      },
      {
        title: '顧客一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/beginningCustomers',
        infoNumber: 0,
      },
      {
        title: 'パートナー一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 2,
        path: '/beginningPartners',
        infoNumber: 0,
      },
      // { // パートナーの場合に表示を変更する場合に使う予定
      //   title: 'パートナー設定',
      //   isShow: true,
      //   roles:[0, 1, 2, 3, 4, 5, 6, 7, 8,9,10]る
      //   subjectIndex: 2,
      //   path: '/beginningPartners',
      //   infoNumber: 0
      // }
      // {
      //   title: '分析一覧',
      //   isShow: true,
      //   roles[0, 1, 2, 3, 4, 5, 6, 7, 8,9,10]
      //     process.env.VITE_IS_BEG_SHOW === 'true' ? [1, 2, 3, 5, 6, 7, 10] : [],
      //   subjectIndex: 1,
      //   path: '/beginningAnalytics',
      //   infoNumber: 0
      // }
    ],
  },

  {
    title: '保証管理',
    isShow: true,
    roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    icon: 'computer',
    path: '/housingEquipmentWarrantyList',
    subtitle: [
      {
        title: '住宅設備延長保証一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/housingEquipmentWarrantyList',
        infoNumber: 0,
      },
      {
        title: '住宅設備延長保証管理一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/housingEquipmentWarrantyManagementList',
        infoNumber: 0,
      },
      {
        title: 'メンテナンス保証管理',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/maintenanceWarrantyManagement',
        infoNumber: 0,
      },
      {
        title: '地震ダンパー保証管理',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/EarthquakeDamperWarrantyManagement',
        infoNumber: 0,
      },
    ],
  },
  {
    title: '保証分析',
    isShow: true,
    roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    icon: 'trending_up',
    path: '/housingEquipmentWarrantyAnalysis',
    subtitle: [
      {
        title: '住宅設備延長保証分析',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/housingEquipmentWarrantyAnalysis',
        infoNumber: 0,
      },
      {
        title: 'メンテナンス保証分析',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/maintenanceWarrantyAnalysis',
        infoNumber: 0,
      },
      {
        title: '地震ダンパー保証分析',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/EarthquakeDamperWarrantyAnalysis',
        infoNumber: 0,
      },
    ],
  },
  {
    title: 'ポイント<br />交換一覧',
    isShow: true,
    roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    icon: 'fact_check',
    path: '/exchangePointList',
    subtitle: [
      {
        title: 'ポイント交換一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/exchangePointList',
        infoNumber: 0,
      },
      {
        title: 'アイテム一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/itemList',
        infoNumber: 0,
      },
      {
        title: 'アイテムカテゴリ一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/itemCategoryList',
        infoNumber: 0,
      },
    ],
  },
  {
    title: '通知一覧',
    isShow: true,
    roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    icon: 'info',
    path: '/notificationList',
    subtitle: [
      {
        title: '通知テンプレート一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/notificationList',
        infoNumber: 0,
      },
      {
        title: '通知送信履歴一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/notificationLogList',
        infoNumber: 0,
      },
      {
        title: '通知予約一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/notificationReservationList',
        infoNumber: 0,
      },
      {
        title: 'アラート一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/alertList',
        infoNumber: 0,
      },
      {
        title: '抽選イベント管理',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/lotteryEventManagement',
        infoNumber: 0,
      },
      {
        title: 'インスタントウィン<br/>アクセスログ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/instantwinAccessLog',
        infoNumber: 0,
      },
    ],
  },
  {
    title: '請求一覧',
    isShow: true,
    roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    icon: 'library_books',
    path: '/createInvoiceForService',
    subtitle: [
      {
        title: 'サービス請求書作成',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/createInvoiceForService',
        infoNumber: 0,
      },
      {
        title: '取次手数料請求書作成',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/createInvoiceForBrokerageFee',
        infoNumber: 0,
      },
      {
        title: 'ポイント請求書作成',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/createInvoiceForPoint',
        infoNumber: 0,
      },
      {
        title: '請求書送信（振込）',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/sendInvoiceForTransfer',
        infoNumber: 0,
      },
      {
        title: '請求書送信（口座振替）',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/sendInvoiceForAccountTransfer',
        infoNumber: 0,
      },
    ],
  },
  {
    title: '会計管理',
    isShow: true,
    roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    icon: 'dvr',
    path: '/feePaymentList',
    subtitle: [
      {
        title: '手数料支払い一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/feePaymentList',
        infoNumber: 0,
      },
      {
        title: '入金確認一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/confirmPayment',
        infoNumber: 0,
      },
      {
        title: '取次手数料入金確認一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/confirmPaymentForBrokerageFee',
        infoNumber: 0,
      },
      {
        title: '取次手数料支払い',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/paymentOfTransactionFee',
        infoNumber: 0,
      },
      {
        title: '仕入れ一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/purchaseList',
        infoNumber: 0,
      },
      {
        title: 'サービス総売上検索',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/serviceTotalSalesSearch',
        infoNumber: 0,
      },
      {
        title: '残高照会',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/balanceInquiry',
        infoNumber: 0,
      },
      {
        title: '利益計算',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/profitCalculation',
        infoNumber: 0,
      },
    ],
  },
  {
    title: 'ORB営業<br />一覧',
    isShow: true,
    roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    icon: 'account_circle',
    path: '/employeeList',
    subtitle: [
      {
        title: '営業担当者一覧',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/employeeList',
        infoNumber: 0,
      },
    ],
  },
  {
    title: 'マスタ管理',
    isShow: true,
    roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    icon: 'article',
    path: '/basicMaster',
    subtitle: [
      {
        title: 'アプリ専用番号マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/AppNumberMaster',
        infoNumber: 0,
      },
      {
        title: 'アプリ専用URLマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/AppUrl',
        infoNumber: 0,
      },
      {
        title: 'ポイントサービス<br />設定マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/pointServiceMaster',
        infoNumber: 0,
      },
      {
        title: '保険料請求書フィルター項目マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/billOutputOrderMaster',
        infoNumber: 0,
      },
      {
        title: '住宅設備マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/housingEquipmentMaster',
        infoNumber: 0,
      },
      {
        title: '火災保険担当者マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/fireInsuranceAgentMaster',
        infoNumber: 0,
      },
      {
        title: '請求書出力順マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/billOutputOrderMaster',
        infoNumber: 0,
      },
      {
        title: '構造マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/buildMethodsMaster',
        infoNumber: 0,
      },
      {
        title: '生命保険カテゴリマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/cateForInsuranceMaster',
        infoNumber: 0,
      },
      {
        title: '比較期間マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/comparisonPeriodMaster',
        infoNumber: 0,
      },
      {
        title: 'コンシェルジュステータスマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/conciergeStatusMaster',
        infoNumber: 0,
      },
      {
        title: '火災保険保険会社マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/fireInsuranceMakersMaster',
        infoNumber: 0,
      },
      {
        title: '会計管理手数料税率マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/accountingManagementFeeTaxRateMaster',
      },
      {
        title: '損害保険カテゴリマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/cateForDamageInsuranceMaster',
        infoNumber: 0,
      },
      {
        title: 'ファミリークーポンURLマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/familyCouponURLMaster',
        infoNumber: 0,
      },
      {
        title: '保険情報通知マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/insuranceInfoForNotificationMaster',
        infoNumber: 0,
      },
      {
        title: '火災保険水災割合マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/fireInsuranceWaterRateMaster',
        infoNumber: 0,
      },
      {
        title: '火災保険ステータスマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/fireInsuranceStatusMaster',
        infoNumber: 0,
      },
      {
        title: 'クラブオフURLマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/clubOffURLMaster',
        infoNumber: 0,
      },
      {
        title: '売り上げ計算方法マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/salesCalcMethodMaster',
        infoNumber: 0,
      },
      {
        title: '支払方法マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/salesPaymentMethodsMaster',
        infoNumber: 0,
      },
      {
        title: '売上ソートマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/salesSortMaster',
        infoNumber: 0,
      },
      {
        title: 'パートナー業種マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/partnerIndustryMaster',
        infoNumber: 0,
      },
      {
        title: '抽選当選回数マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/numberOfPastWinsOptionsMaster',
        infoNumber: 0,
      },
      {
        title: '請求書ステータスマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/invoicingStatusMaster',
        infoNumber: 0,
      },
      {
        title: '請求書DL方法マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/invoiceDLMethodMaster',
        infoNumber: 0,
      },
      {
        title: '請求書作成マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/invoiceCreationMaster',
        infoNumber: 0,
      },
      {
        title: '販促物カテゴリマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/partnerPromotionalMaterialsMaster',
        infoNumber: 0,
      },
      {
        title: '仕入原価カテゴリマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/purchaseMaster',
        infoNumber: 0,
      },
      {
        title: 'ポイントカテゴリマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/pointKindMaster',
        infoNumber: 0,
      },
      {
        title: '支払カテゴリマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/paymentTypeMaster',
        infoNumber: 0,
      },
      {
        title: '事故対応カテゴリマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/recoveryInsuranceMaster',
        infoNumber: 0,
      },
      {
        title: '支払い元マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/paymentSourceMaster',
        infoNumber: 0,
      },
      {
        title: 'メーカーマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/makersForWarrantyMaster',
        infoNumber: 0,
      },
      {
        title: '生命保険ステータスマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/lifeInsuranceStatusMaster',
        infoNumber: 0,
      },
      {
        title: '生命保険メーカーマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/lifeInsuranceMakerMaster',
        infoNumber: 0,
      },
      {
        title: '住宅設備保証マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/housingEquipmentWarrantyMaster',
        infoNumber: 0,
      },
      {
        title: '標準設備マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/facilitiesForStandardMaster',
        infoNumber: 0,
      },

      {
        title: '損害箇所マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/facilitiesForReportMaster',
        infoNumber: 0,
      },
      {
        title: '来年の設備マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/facilitiesForNextYearMaster',
        infoNumber: 0,
      },
      {
        title: '締切月設定マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/deadlineAMonthMaster',
        infoNumber: 0,
      },
      {
        title: '当選した保険カテゴリーマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/winnerSelectionFireInsuranceMaster',
        infoNumber: 0,
      },
      {
        title: 'マニュアルカテゴリーマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/cateForManualMaster',
        infoNumber: 0,
      },
      {
        title: '点検予定マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/InspectionMaster',
        infoNumber: 0,
      },
      {
        title: '点検年数マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/InspectionYearMaster',
        infoNumber: 0,
      },
      {
        title: '修繕箇所マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/RepairPartMaster',
        infoNumber: 0,
      },
      {
        title: '建物情報マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/housingInfoMaster',
        infoNumber: 0,
      },
      {
        title: '三井住友海上火災保険メールアドレス',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/MitsuiMailAddress',
        infoNumber: 0,
      },
      {
        title: 'インスタントウィンURL',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/instantwinURLMaster',
        infoNumber: 0,
      },
      {
        title: 'ファミリーモバイル補償URLマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/familyMobileURLMaster',
        infoNumber: 0,
      },
      {
        title: 'ビギニングマスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/beginMasters',
        infoNumber: 0,
      },
      {
        title: 'アプリ操作説明動画<br/>マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/appManuelVideoMaster',
        infoNumber: 0,
      },
      {
        title: 'サービスコンテンツ</br>マスタ',
        isShow: true,
        roles: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
        subjectIndex: 1,
        path: '/serviceContentsMaster',
        infoNumber: 0,
      },
    ] as _Subtitle[],
  },
]

const navi = computed(() => {
  return [...defaultNavi]
    .filter((d) => {
      return d.isShow && showFromRole.value(d.roles)
    })
    .map((d) => {
      if (!d?.subtitle) return d
      return {
        ...d,
        subtitle: [...d.subtitle]
          .filter((s) => {
            if (!s.isShow) return false
            return showFromRole.value(s.roles)
          })
          .map((s) => {
            if (s.title === '住宅設備変更確認') {
              return {
                ...s,
                infoNumber: 0,
              }
            }
            if (
              d.title === 'ビギニング' &&
              s.title === 'パートナー一覧' &&
              s.path === '/beginningPartners'
            ) {
              return {
                ...s,
                path: `/beginningPartnersPage/aaaa#見込み度合いフラグ管理`,
              }
            }

            if (s.title === 'パートナー一覧') {
              return {
                ...s,
                path: `/partnerDetail/aaaa#基本情報`,
              }
            }

            if (s.title === '代理店一覧') {
              return {
                ...s,
                path: `/agencyDetail/aaaa#基本情報`,
              }
            }
            if (s.title === '紹介者一覧') {
              return {
                ...s,
                path: `/agencyDetail/aaaa#基本情報`,
              }
            }
            return s
          }),
      }
    })
    .filter((d) => {
      if (!d.isShow) return false
      if (d.title === '保証分析') {
        return false
      }
      return showFromRole.value(d.roles)
    })
    .map((d) => {
      if (d.title === 'パートナー一覧') {
        return {
          ...d,
          path: `/partnerDetail/aaaa#基本情報`,
        }
      }
      if (d.title === '代理店一覧') {
        return {
          ...d,
          path: `/agencyDetail/aaaa#基本情報`,
        }
      }
      if (d.title === '紹介者一覧') {
        return {
          ...d,
          path: `/agencyDetail/aaaa#基本情報`,
        }
      }
      if (d.title === 'コンシェルジュ履歴') {
        return {
          ...d,
          subtitle: d.subtitle.map((s) => {
            if (s.title === 'テスト表示') {
              return {
                ...s,
                infoNumber: 0,
              }
            }
            if (s.title === 'チャット一覧') {
              return {
                ...s,
                infoNumber: 0,
              }
            }
            return {
              ...s,
              infoNumber: 0,
            }
          }),
        }
      }

      if (d.title === '保証分析') {
        return {
          ...d,
          subtitle: d.subtitle.filter((s) => {
            if (s.title === '住宅設備延長保証分析') {
              return false
            }
            if (s.title === 'メンテナンス保証分析') {
              return false
            }
            if (s.title === '地震ダンパー保証分析') {
              return false
            }
            return true
          }),
        }
      }

      return d
    })
})
</script>

<template>
  <div>
    <CCGlobalNavi
      class="_navi"
      v-model:fullPath="path"
      :subjects="navi"
      @push="(val) => clickNav(val)"
      :logoUrl="brokenUrl"
      :mainLogo="mainLogo"
    />
    {{ path }}
  </div>
</template>

<style scoped></style>
