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

include _ADM_INC_PATH_ ."/header.html";


$mmn = new Menu(TB_menu_list);
$mmn->cate_area = "admin";
$mmn->auth = "";
pp($mmn->getMenuList(""));
exit;
?>

        <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="auth_info_body" class="container-fluid mt-3">
          <div class="row">
            <div class="col">
              <h5 class="d-flex justify-content-between">
                <span><i class="bi bi-subtract"></i> 권한 정보</span>

                <select class="form-select form-select-sm inline" v-model="Bran_filter">
                  <option value="">- 전체 -</option>
                  <option :value="code.Code_Uid" v-for="code in OptGroups('','','Code_Exp')">{{code.Code_Exp}} ({{code.Code_Uid}})</option>
                </select>
              </h5>
              <div class="mt-3 cont_hfix">
                <table class="table">
                  <colgroup>
                    <col width="5%"/>
                    <col width="15%"/>
                    <col width="20%"/>
                    <col width="20%"/>
                    <col width="*"/>
                    <col width="10%"/>
                    <col width="10%"/>
                  </colgroup>
                  <thead class="text-center bg-dark text-light top_sticky">
                    <tr>
                      <th>NO</th>
                      <th>Group</th>
                      <th>Code Id</th>
                      <th>Code Val</th>
                      <th>Code Exp</th>
                      <th>Code Idx</th>
                      <th>Code Use</th>
                    </tr>
                  </thead>
                  <tbody>
                    <template v-for="(code, idx) in getSortCodeList(Bran_filter)">

                      <tr
                        :class="{'text-center':1,'bg-lightgrey code-start':code.Group_Uid==code.Code_Uid,'bg-warning':code.Group_Uid==forms.Group_Uid && code.Code_Uid==forms.Code_Uid}"
                        @click="putForm(code)">
                      <td style="background:#F4F5F7;" class="text-right">{{idx+1}}</td>
                      <td v-if="code.Group_Uid==code.Code_Uid" :rowSpan="LCodeList.filter(v=>v.Group_Uid == code.Code_Uid).length">
                        <div>{{code.Code_Uid}}<div>({{code.Code_Exp}})</div></div>
                      </td>
                      <td>{{code.Code_Uid}}</td>
                      <td>{{code.Code_Val}}</td>
                      <td>{{code.Code_Exp}}</td>
                      <td>{{code.Code_Idx}}</td>
                      <td>{{code.Code_Active}}</td>
                    </tr>
                    </template>
                  </tbody>
                </table>
              </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 src="https://cdn.jsdelivr.net/npm/jquery-treetable@3.2.0-1/jquery.treetable.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-treetable@3.2.0-1/css/jquery.treetable.theme.default.css">
<script>

</script>