<template>
    <div class="title-box flex justify-between mb40">
    <p class="title">{{ bookDetails ? bookDetails.book_nm : 'Loading...' }}</p>
  </div>
    <label for="" class="title1">단원</label>
        <div class="unit-pagination flex mt10" style="gap: 10px;">
            <button class="selected-btn">1</button>
            <button>2</button>
            <button>3</button>
            <button ><svg-icon type="mdi" :path="mdiPlus" style=" padding-top: 6px; width: 30px; height: 30px;"></svg-icon></button>
        </div>
    <div class="board-wrap mt30">
        <div class="mb20 ">
            <div class="flex justify-between mb30 align-center">
                <label for="" class="title1">지문</label>
                <div class="look-btn flex align-center" @click="goToPage('TextList')">
                    <p>자세히 보기 </p>
                    <svg-icon type="mdi" :path="mdilArrowRight" class=" ml10"></svg-icon>
                </div>
            </div>
            <div class="table-wrap">
                <table>
                    <thead>
                        <td>No.</td>
                        <td>제목</td>
                        <td>내용</td>
                        <td>작성자</td>
                        <td>등록일</td>
                    </thead>
                    <tbody>
                        <tr>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <hr>
        <div class="mb20" >
            <div class="flex justify-between mb30 align-center">
                <label for="" class="title1">문제</label>
                <div class="look-btn flex align-center" @click="goToPage('QuestionList')">
                    <p>자세히 보기 </p>
                    <svg-icon type="mdi" :path="mdilArrowRight" class=" ml10"></svg-icon>
                </div>
            </div>
            <div class="table-wrap">
                <table>
                    <thead>
                        <td>No.</td>
                        <td>제목</td>
                        <td>내용</td>
                        <td>작성자</td>
                        <td>등록일</td>
                    </thead>
                    <tbody>
                        <tr>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <hr>
        <div class="mb20" >
            <div class="flex justify-between mb30 align-center">
                <label for="" class="title1">단어</label>
                <div class="look-btn flex align-center" @click="goToPage('VocaList')">
                    <p>자세히 보기 </p>
                    <svg-icon type="mdi" :path="mdilArrowRight" class=" ml10"></svg-icon>
                </div>
            </div>
            <div class="table-wrap">
                <table>
                    <thead>
                        <td>No.</td>
                        <td>단어</td>
                        <td>뜻</td>
                        <td>작성자</td>
                        <td>등록일</td>
                    </thead>
                    <tbody>
                        <tr>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <hr>
        <div class="mb20" >
            <div class="flex justify-between mb30 align-center">
                <label for="" class="title1">중간 평가</label>
                <div class="look-btn flex align-center" @click="goToPage('ExamList')">
                    <p>자세히 보기 </p>
                    <svg-icon type="mdi" :path="mdilArrowRight" class=" ml10"></svg-icon>
                </div>
            </div>
            <div class="table-wrap">
                <table>
                    <thead>
                        <td>No.</td>
                        <td>제목</td>
                        <td>내용</td>
                        <td>작성자</td>
                        <td>등록일</td>
                    </thead>
                    <tbody>
                        <tr>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <hr>
        <div >
            <div class="flex justify-between mb30 align-center">
                <label for="" class="title1">최종 평가</label>
                <div class="look-btn flex align-center" @click="goToPage('ExamList')">
                    <p>자세히 보기 </p>
                    <svg-icon type="mdi" :path="mdilArrowRight" class=" ml10"></svg-icon>
                </div>
            </div>
            <div class="table-wrap">
                <table>
                    <thead>
                        <td>No.</td>
                        <td>제목</td>
                        <td>내용</td>
                        <td>작성자</td>
                        <td>등록일</td>
                    </thead>
                    <tbody>
                        <tr>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <!-- <div class="flex justify-end mt30" style="gap: 10px;">
        <button type="button" title="" class="new-btn" @click="goToPage('RoadMap')">
            로드맵
        </button>
        <button type="button" title="" class="new-btn" @click="showConfirm('delete')">
            삭제
        </button>
    </div> -->
</template>

<script>
import SvgIcon from '@jamescoyle/vue-icon';
import { mdiMagnify, mdiPlus } from '@mdi/js';
import { mdilArrowRight } from '@mdi/light-js';
import ProgressBar from '../../component/ProgressBar.vue';
import axios from 'axios';

export default {
    data() {
        return {
            mdiPlus: mdiPlus,
            mdiMagnify: mdiMagnify,
            mdilArrowRight: mdilArrowRight,
            selectedBookId: this.$route.query.book_Id,
            bookDetails: null,
        };
    },
    methods: {
        goToPage(page) {
            this.$router.push({ name: page });
        },
        fetchBookDetails() {
            axios({
                url: "/book/find.json",
                method: "post",
                headers: {
                    "Content-Type": "application/json; charset=UTF-8",
                },
                data: {
                    book_id: this.$route.query.book_id
                }
            })
            .then(response => {
                console.log('Book details:', response.data);
                this.bookDetails = response.data;
            })
            .catch(error => {
                console.error('Error fetching book details:', error);
            });
        }
    },
    mounted() {
        console.log('Mounted with book_id:', this.$route.query.book_id);
        this.fetchBookDetails();
    },
    components: {
        SvgIcon,
        ProgressBar
    }
}
</script>
<style scoped></style>