let adminRequestModal;

$(function(){
    adminRequestModal = new bootstrap.Modal(document.getElementById('adminRequestModal'));
})

$(document).on('click', '.title-td', function (){
    adminRequestModalOpen('/admin/request/'+$(this).attr("data-idx"));
})

function adminRequestModalOpen(url){
    $.ajax({
        url: url,
        type: 'GET',
        dataType:"html",
        success: function(html){
            $("#adminRequestModalBody").empty().append(html);
            adminRequestModal.show();
        },
        error:function(){
            adminRequestModalBody
        }
    });
}

function fn_link_page(pageNo) {
    document.searchForm.pageIndex.value = pageNo;
    document.searchForm.action = '/admin/request';
    document.searchForm.submit();
}

function confirmReqBtn(val) {
    $("#status").val(val);

    var msg;
    if (val == 0) {
        msg = "승인";
    } else {
        msg = "거절";
    }

    if (confirm("지도사용요청을 " + msg + " 하시겠습니까?")) {
        $("#updateFrm").submit();
    } else {
        return false;
    }
}
