<!DOCTYPE html>
<html lang="zh-tw">

<head><?php
      // 引用 head.inc
      include_once "html_head.inc";
      ?></head>

<body>
  <div id="q-app" :visible="IsVueReady==true" @mousemove="FnIdleReset">
    <?php
    // include_once "html_menu.inc";
    include_once "html_layout_header.inc";
    ?>
    <!-- 內容區域 //-->
    <data-table :show-search-field="true" :show-search-btn="false" :show-search-panel="false" :title="$t('menu.admin_page_permission_setting')" :columns="columns" :data="tableData" row-key="name">

      <!-- <template v-slot:row-control="props">
        <q-btn color="primary" :label="$t('sys.view')" @click.native="editUser(props.row_data)"></q-btn>
      </template> -->

      <template v-slot:row_col_view_page="props">
        <q-btn color="primary" :label="$t('sys.view')" @click.native="viewRoleId(props.row_data.row)" v-if="edit_cheak"></q-btn>
      </template>
      <template v-slot:row_col_view_store="props">
        <q-btn color="primary" :label="$t('sys.view')" @click.native="view_store_ctrl(props.row_data.row)" v-if="edit_cheak"></q-btn>
      </template>


    </data-table>

    <!--表單-->
    <template v-if="edit_cheak">
      <q-modal v-model="formPageSet['view']" minimized no-route-dismiss no-esc-dismiss no-backdrop-dismiss :content-css="{minWidth: '50vw', maxHeight: '100vh'}">
        <div class="modal-title">
          <div>
            {{ $t('page.admin_page_permission_setting.columns.view_page') }}
          </div>
        </div>
        <div class="modal-scroll-box">
          <div v-for="(item ,idx) in formPageSet['tempPageName']">

            <span v-if="item['children'] == undefined || item['children'] != []">
              <q-checkbox v-if="item['show_check']" @input="checkbox_link(`${idx}`)" v-model="formPageSet['tempSelectUse']" :disable="formPageSet['edit']" :val="item['menu_id']" class="q-mr-sm">
              </q-checkbox>
              <!-- <span class="material-icons">{{ item['icon'] }}</span> -->
              {{ $t('menu.'+item['menu_id']) }}
            </span>
            <div v-if="item['function'] != undefined || item['function'] != []" class="row q-ml-lg">
              <span v-for="(func_item ,func_idx) in item['function']">
                <q-checkbox v-model="formPageSet['tempSelectUse']" @input="checkbox_link(`${idx}.${func_idx}`)" :disable="formPageSet['edit']" :val="item['menu_id']+'.'+func_item" class="q-mr-sm">
                  {{ $t('sys.'+func_item) }}
                </q-checkbox>
              </span>
            </div>
            <div v-if="item['children'] != undefined" style="display: flex;flex-flow: column wrap;">
              <div v-for="(item2 ,idx2) in item['children']" class="column q-ml-lg">
                <span>
                  <q-checkbox v-model="formPageSet['tempSelectUse']" @input="checkbox_link(`${idx}-${idx2}`)" :disable="formPageSet['edit']" :val="item2['menu_id']" class="q-mr-sm"></q-checkbox>
                  {{ $t('menu.'+item2['menu_id']) }}
                </span>
                <div v-if="item2['function'] != undefined" class="row q-ml-lg">
                  <span v-for="(item3 ,idx3) in item2['function']">
                    <q-checkbox v-model="formPageSet['tempSelectUse']" @input="checkbox_link(`${idx}-${idx2}.${idx3}`)" :disable="formPageSet['edit']" :val="item2['menu_id']+'.'+item3" class="q-mr-sm">
                      {{ $t('sys.'+item3) }}
                    </q-checkbox>
                  </span>
                </div>
              </div>
            </div>

          </div>
        </div>
        <div style="display:flex; flex-grow: row; justify-content: center;margin: 20px;">
          <q-btn color="primary" :label="$t('sys.edit')" class="btn-style2" @click="btnSwitch()" v-if="formPageSet['edit']"></q-btn>
          <q-btn color="primary" :label="$t('sys.update')" class="btn-style2" @click="updateRoleMenu()" v-if="formPageSet['update']"></q-btn>
          <q-btn color="secondary" :label="$t('sys.close')" class="btn-style2" @click="formPageSet['view'] = false"></q-btn>
        </div>
      </q-modal>
    </template>

    <!--門市顯示設定表單-->
    <template v-if="edit_cheak">
      <q-modal v-model="formStoreSet['view']" minimized no-route-dismiss no-esc-dismiss no-backdrop-dismiss>
        <div class="modal-title">
          <div>
            {{ $t('page.admin_page_permission_setting.columns.view_store') }}
          </div>
        </div>
        <div class="row justify-center" style="padding: 20px;">
          <q-checkbox v-model="formStoreSet['value']" style="font-weight: 800;" label="隱藏尚未營運的門市" :disable="!formStoreSet['update']" />
        </div>
        <div style="display:flex; flex-grow: row; justify-content: center;margin: 20px;">
          <q-btn color="primary" :label="$t('sys.update')" class="btn-style2" @click="update_view_store()" v-if="formStoreSet['update']"></q-btn>
          <q-btn color="secondary" :label="$t('sys.close')" class="btn-style2" @click="formStoreSet['view'] = false"></q-btn>
        </div>
      </q-modal>
    </template>

    <?php
    include_once "html_layout_footer.inc";
    ?>
  </div>
  <?php
  // loading.inc
  include_once "html_loading.inc";
  ?>
</body>
<?php
$is_report_download = true;
// 引用 down.inc
include_once "html_down.php";
?>

</html>