<?php
include_once "{$_SERVER['DOCUMENT_ROOT']}/common.inc.php";
include_once _ADM_INC_PATH_ ."/auth_check.php";

include _ADM_INC_PATH_ ."/header.html";
?>

        <div id="cmd_bar" class="mb-2">
          <div class="h4"><i class="bi bi-files-alt"></i> 메뉴 관리</div>
          <div class="text-right">
          </div>
        </div>

        <div id="base_info_body" class="container-fluid mt-3">
          <div class="row">
            <div class="col">
              <h5><i class="bi bi-subtract"></i> 메뉴 리스트</h5>
              <div class="mt-3 cont_hfix">
                <div id="your_table_id" class="treeview">

<div id="tree"></div>

                </div>
              </div>
            </div>
            <div class="col">
              <h5><i class="bi bi-subtract"></i> 메뉴 정보</h5>
              <form method="post" name="codeform" class="mt-3 fadmin" action="###" onsubmit="return false">
                <div class="fld-block">
                  <label for="Group_Uid" class="form-label">Group ID</label>
                  <div>
                    <select class="form-select inline" id="Group_Uid" name="Group_Uid" v-model="forms.Group_Uid" :disabled="forms.Group_Uid != '' && forms.Group_Uid == forms.Ori_Group_Uid">
                      <option value="">- 상위분류 -</option>
                      <option :value="code.Code_Uid" v-for="code in OptGroups('','','Code_Exp')">{{code.Code_Exp}} ({{code.Code_Uid}})</option>
                    </select>
                  </div>
                </div>
                <div class="fld-block">
                  <label for="Code_Uid" class="form-label">Code ID</label>
                  <div>
                    <input type="text" class="form-control inline" id="Code_Uid" name="Code_Uid" v-model="forms.Code_Uid" placeholder="Code Id">
                    <small class="text-info">※ ID는 분류내에서 유일한(Unique)한 값이어야 합니다.</small>
                  </div>
                </div>
                <div class="fld-block">
                  <label for="Code_Val" class="form-label">Code Value</label>
                  <div>
                    <input type="text" class="form-control inline" id="Code_Val" name="Code_Val" v-model="forms.Code_Val" placeholder="Code Value">
                  </div>
                </div>
                <div class="fld-block">
                  <label for="Code_Val" class="form-label">Code Explain</label>
                  <div>
                    <input type="text" class="form-control inline" id="Code_Exp" name="Code_Exp" v-model="forms.Code_Exp" placeholder="Code Explain">
                  </div>
                </div>
                <div class="fld-block">
                  <label for="Code_Idx" class="form-label">Code Index</label>
                  <div>
                    <input type="text" class="form-control inline" id="Code_Idx" name="Code_Idx" v-model="forms.Code_Idx" placeholder="Code Index">
                    <small class="text-info">※ 출력순서를 지정합니다. 입력한 index의 후순위 코드들은 자동으로 순위가 변경 적용됩니다.</small>
                  </div>
                </div>
                <div class="fld-block">
                  <label for="Active" class="form-label">Active</label>
                  <div class="form-check">
                    <input type="checkbox" class="form-check-input" id="Active" name="Active" true-value="Y" false-value="N" v-model="forms.Code_Active">
                    <small class="text-info">※ 사용하지 않을경우 체크해제 합니다.</small>
                  </div>
                </div>
                <div class="mt-4 text-center">
                  <button type="button" class="btn btn-sm btn-warning px-5" @click="resetForm()">Reset</button> <button type="button" class="btn btn-sm btn-primary px-5" @click="execCode('putCode')">Submit</button> <button type="button" class="btn btn-sm btn-danger px-5" @click="execCode('delCode')">Delete</button>
                </div>
              </form>
            </div>
          </div>
        </div>
<?php

include _ADM_INC_PATH_ ."/footer.html";
?>

<script>
jQuery('#tree').treeview({
  nodeIcon: 'bi-bookmark',
  selectedBackColor: 'orange',
  showTags: true,
  data: [{
    text: "Parent 1",
    exvars: {
      aaa: 11,
      bbb: 22,
      ccc: 33,
      ddd: 44,
    },
    nodes: [
      {
        text: "Child 1",
        nodes: [
          {
            text: "Grandchild 1",
    tags: ['바보','천재','선택해'],
          },
          {
            text: "Grandchild 2"
          }
        ]
      },
      {
        text: "Child 2"
      }
    ]
  },
  {
    text: "Parent 2"
  },
  {
    text: "Parent 3"
  },
  {
    text: "Parent 4"
  },
  {
    text: "Parent 5"
  }
]});
</script>
