<?php $CURRENT_SECTION = 'approval';
include '../inc/header.php'; ?>
    <div class="container" style="max-width:1280px; margin-top:24px;">
        <div class="card shadow-sm">
            <div class="card-header d-flex justify-content-between align-items-center">
                <strong>결재 대상 관리</strong>
                <button class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#objModal">추가</button>
            </div>
            <div class="card-body">
                <table class="table table-hover align-middle text-center">
                    <thead class="table-light"><tr><th>코드</th><th>이름</th><th>연결 메뉴</th><th style="width:140px;">관리</th></tr></thead>
                    <tbody>
                    <tr><td>LEAVE</td><td>연차 신청</td><td>/tenant/hr/leave_apply.php</td>
                        <td><a class="btn btn-sm btn-outline-secondary" href="/tenant/approval/rules.php?object=LEAVE">규칙</a>
                            <button class="btn btn-sm btn-outline-danger">삭제</button></td></tr>
                    <tr><td>IQC_REPORT</td><td>수입성적서</td><td>/tenant/quality/iqc_report.php</td>
                        <td><a class="btn btn-sm btn-outline-secondary" href="/tenant/approval/rules.php?object=IQC_REPORT">규칙</a>
                            <button class="btn btn-sm btn-outline-danger">삭제</button></td></tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <!-- 대상 추가 모달 -->
    <div class="modal fade" id="objModal" tabindex="-1" aria-hidden="true">
        <div class="modal-dialog"><div class="modal-content">
                <div class="modal-header"><h5 class="modal-title">결재 대상 추가</h5><button class="btn-close" data-bs-dismiss="modal"></button></div>
                <div class="modal-body">
                    <div class="mb-2"><label class="form-label">코드</label><input class="form-control" id="objCode"></div>
                    <div class="mb-2"><label class="form-label">이름</label><input class="form-control" id="objName"></div>
                    <div class="mb-2"><label class="form-label">연결 메뉴 경로</label><input class="form-control" id="objPath" placeholder="/tenant/..."></div>
                </div>
                <div class="modal-footer"><button class="btn btn-secondary" data-bs-dismiss="modal">닫기</button><button class="btn btn-primary" id="saveObj">저장</button></div>
            </div></div>
    </div>

    <script>
        $(function(){
            $('#saveObj').on('click', function(){ alert('저장(샘플) /api/approval/object_save.php'); $('#objModal').modal('hide'); });
        });
    </script>
<?php include '../inc/footer.php'; ?>
