<?php get_header();
/**
 * The template for displaying archive pages
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package WordPress
 * @subpackage jcc
 * @since 1.0.0
 */

$term = get_queried_object();
$term_id = $term->term_id;
$current_language = pll_current_language();

?>
    <div class="faculty-profile-banner d-flex justify-content-center align-items-center"
         style="background-image: linear-gradient(rgb(37 59 128), rgba(1, 39, 11, 0.75)),url(<?php echo get_site_url(); ?>/wp-content/uploads/2024/07/IMG-20240728-WA0000.jpg) ">
        <h1 class="text-white text-center"><?php echo esc_html(single_cat_title('', false)); ?></h1>
    </div>

    <!-- Hero Title -->

    <!-- Profile -->
    <section class="about my-5 d-none">
        <div class="container profile">
            <div class="row">
                <div class="col-lg-4 col-md-12 col-sm-12">
                    <div class="text-center bg-light shadow rounded" style="height: 550px">
                        <div class="">
                            <div class="img p-4" style="height:400px ">
                                <img class="rounded w-100 h-100"
                                     src="../public/upload/profiles/202306250722Brig%20Gen%20Arefin%20BUP.jpg"
                                     onerror="this.onerror=null;this.src='../public/upload/user-dummy.jpg';"/>
                            </div>
                        </div>

                        <div class="text-center px-3 pb-3 bg-light rounded" style="height: 150px; ">
                            <div class="border-top pt-3">
                                <a href="../faculty-member-head/details/301.html"
                                   class="text-dark fw-bold fs-5 mb-0 lh-sm faculty-title">Brigadier General
                                    Mohammad
                                    Shamsul Arefin, ndc, psc</a>

                                <p class="fw-bold common-font-color fs-6 mb-1 pt-2">Dean</p>

                            </div>
                        </div>

                    </div>
                </div>
                <div class="col-lg-8 col-md-12 col-sm-12">
                    <div class="bg-light p-3 rounded shadow about-message-content " style="height: 550px">
                        <?php
                        $args = array(
                            'post_type' => 'faculty',
                            'post_status' => 'publish',
                            'tax_query' => array(
                                array(
                                    'taxonomy' => $term->taxonomy,
                                    'field'    => 'term_id',
                                    'terms'    => $term_id,
                                ),
                            ),
                            'posts_per_page' => 1,
                            'lang' => $current_language,

                        );
                        $loop = new WP_Query($args);
                        if ($loop->have_posts()) {
                            while ($loop->have_posts()) {
                                $loop->the_post();
                                ?>
                                <div>
                                    <h2 class="fs-3 fw-bold border-bottom pb-3 mb-3 common-font-color">About <?php the_title(); ?></h2>
                                    <div class="text-justify fs-6">
                                        <?php
                                        $content = get_the_content();
                                        echo wp_trim_words($content, 1000);
                                        ?>
                                        <a href="<?php the_permalink(); ?>" class="ms-1 fw-bold">Read More</a>
                                    </div>
                                </div>
                                <?php
                            }
                        } else {
                            echo '<p>No posts found.</p>';
                        }
                        wp_reset_postdata();
                        ?>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Our Departments -->
    <section class="mt-5">
        <div class="container">
            <div class="d-flex justify-content-between align-items-end">
                <h1 class="text-uppercase mb-0 home-content-heading"><?php echo pll_e('departments') ?></h1>
            </div>
            <div class="position-relative w-100 common-bg-color mt-1" style="height: 4px;"></div>

            <div class="row">
                <?php
                $args = array(
                    'post_type' => 'department',
                    'tax_query' => array(
                        array(
                            'taxonomy' => $term->taxonomy,
                            'field'    => 'term_id',
                            'terms'    => $term_id,
                        ),
                    ),
                    'posts_per_page' => -1,
                    'lang' => $current_language,
                    'orderby' => 'menu_order', // Order by post type order (menu order)
                    'order' => 'ASC' // Use 'ASC' for ascending order, 'DESC' for descending
                );
                $loop = new WP_Query($args);
                if ($loop->have_posts()) {
                    while ($loop->have_posts()) {
                        $loop->the_post();
                        get_template_part('template/department', get_post_format());
                    }
                } else {
                    echo '<p>No departments found.</p>';
                }
                wp_reset_postdata();
                ?>
            </div>
        </div>
    </section>




    <!-- Our Faculty -->


    <!-- Notice & Events -->
    <section class="my-5">
        <div class="container">
            <div class="row">
                <div class="col-lg-12">
                    <div class="d-flex justify-content-between align-items-end">
                        <h1 class="text-uppercase mb-0 home-content-heading">
                            <?php echo pll_e('notices') ?>
                        </h1>
                        <?php $current_language = pll_current_language();
                        if ($current_language == 'en') { ?>
                            <a href="<?php echo get_site_url(); ?>/notice"
                               class="text-uppercase text-decoration-none fw-bold common-font-color">All</a>
                        <?php } elseif ($current_language == 'bn') { ?>
                            <a href="<?php echo get_site_url(); ?>/bn/notice"
                               class="text-uppercase text-decoration-none fw-bold common-font-color">সকল</a>
                        <?php } ?>
                    </div>

                    <div class="position-relative w-100 common-bg-color mt-1" style="height: 4px;">
                    </div>
                    <div class="row mx-0 upcoming-events ">
                        <?php
                        $args = array(
                            'post_type' => 'notice',
                            'tax_query' => array(
                                array(
                                    'taxonomy' => $term->taxonomy,
                                    'field'    => 'term_id',
                                    'terms'    => $term_id,
                                ),
                            ),
                            'posts_per_page' => 5,
                            'lang' => $current_language
                        );
                        $loop = new WP_Query($args);
                        if ($loop->have_posts()) {
                            while ($loop->have_posts()) {
                                $loop->the_post();
                                get_template_part('template/dept_wise_notice', get_post_format());
                            }
                        } else {
                            echo '<p>No Notice found.</p>';
                        }
                        wp_reset_postdata();
                        ?>



                    </div>
                </div>


            </div>
        </div>
    </section>

    <!-- Lab -->
    <section class="bg-light hidden">

        <div class="pt-5 pb-5 home-academics">
            <div class=" container">
                <div class="d-flex justify-content-between align-items-end">
                    <h1 class="text-uppercase mb-0 home-content-heading">
                        <?php echo pll_e('laboratory') ?>
                    </h1>

                </div>
                <div class="position-relative w-100 common-bg-color mt-1" style="height: 4px;">
                </div>

                <div class="row">
                    <?php
                    $args = array(
                        'post_type' => 'lab',
                        'tax_query' => array(
                            array(
                                'taxonomy' => $term->taxonomy,
                                'field'    => 'term_id',
                                'terms'    => $term_id,
                            ),
                        ),
                        'posts_per_page' => 5,
                        'lang' => $current_language
                    );
                    $loop = new WP_Query($args);
                    if ($loop->have_posts()) {
                        while ($loop->have_posts()) {
                            $loop->the_post();
                            get_template_part('template/dept_wise_lab', get_post_format());
                        }
                    } else {
                        echo '<p>No Notice found.</p>';
                    }
                    wp_reset_postdata();
                    ?>
                    


                </div>
            </div>
        </div>

    </section>

    <!-- Club -->
    <section class="d-none">
        <div class=""
             style="background-image: url(../public/frontend/assets/img/bup/oncampus_banner.png); background-repeat: no-repeat; background-position: center; background-size: cover;">
            <div class="container py-5">
                <div class="d-flex justify-content-between align-items-end">
                    <h1 class="text-uppercase mb-0 home-content-heading">
                        Clubs
                    </h1>

                </div>
                <div class="position-relative w-100 common-bg-color mt-1" style="height: 4px;">
                </div>
                <div class="row">
                    <div class="col-lg-3 col-md-12 mt-3 ">
                        <a href="../club-home/bup-economics-club.html">
                            <div class="over-container">
                                <img src="../public/upload/banner/20230402_1680450270547.jpg"
                                     style="height: 242px; object-fit:cover;"
                                     onerror="this.onerror=null;this.src='../public/upload/no-image.png';"
                                     class=" shadow-1-strong  over-img" alt="Student Life"/>
                                <div class="position-absolute campus-title" style="right:0px; bottom:20px">
                                    <div class=" text-white d-flex justify-content-center"
                                         style="width: 200px; height: 40px; background: #B60404; box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);">
                                        <p class="mt-2 text-right"> BUP Economics Club </p>
                                    </div>
                                </div>
                                <div class="overlay">
                                    <div class="text">BUP Economics Club</div>
                                </div>
                            </div>
                        </a>
                    </div>
                    <div class="col-lg-3 col-md-12 mt-3 ">
                        <a href="../club-home/bup-cultural-forum.html">
                            <div class="over-container">
                                <img src="../public/upload/banner/20230325_1679739709407.jpg"
                                     style="height: 242px; object-fit:cover;"
                                     onerror="this.onerror=null;this.src='../public/upload/no-image.png';"
                                     class=" shadow-1-strong  over-img" alt="Student Life"/>
                                <div class="position-absolute campus-title" style="right:0px; bottom:20px">
                                    <div class=" text-white d-flex justify-content-center"
                                         style="width: 200px; height: 40px; background: #B60404; box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);">
                                        <p class="mt-2 text-right"> BUP Cultural Forum </p>
                                    </div>
                                </div>
                                <div class="overlay">
                                    <div class="text">BUP Cultural Forum</div>
                                </div>
                            </div>
                        </a>
                    </div>
                    <div class="col-lg-3 col-md-12 mt-3 ">
                        <a href="../club-home/disaster-management-forum-dmf.html">
                            <div class="over-container">
                                <img src="../public/upload/banner/20230525_1684993169766.jpg"
                                     style="height: 242px; object-fit:cover;"
                                     onerror="this.onerror=null;this.src='../public/upload/no-image.png';"
                                     class=" shadow-1-strong  over-img" alt="Student Life"/>
                                <div class="position-absolute campus-title" style="right:0px; bottom:20px">
                                    <div class=" text-white d-flex justify-content-center"
                                         style="width: 200px; height: 40px; background: #B60404; box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);">
                                        <p class="mt-2 text-right"> Disaster Managemen... </p>
                                    </div>
                                </div>
                                <div class="overlay">
                                    <div class="text">Disaster Management Forum (DMF)</div>
                                </div>
                            </div>
                        </a>
                    </div>
                    <div class="col-lg-3 col-md-12 mt-3 ">
                        <a href="../club-home/bup-band-society.html">
                            <div class="over-container">
                                <img src="../public/upload/banner/20230803_169104757980.jpg"
                                     style="height: 242px; object-fit:cover;"
                                     onerror="this.onerror=null;this.src='../public/upload/no-image.png';"
                                     class=" shadow-1-strong  over-img" alt="Student Life"/>
                                <div class="position-absolute campus-title" style="right:0px; bottom:20px">
                                    <div class=" text-white d-flex justify-content-center"
                                         style="width: 200px; height: 40px; background: #B60404; box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);">
                                        <p class="mt-2 text-right"> BUP Band Society </p>
                                    </div>
                                </div>
                                <div class="overlay">
                                    <div class="text">BUP Band Society</div>
                                </div>
                            </div>
                        </a>
                    </div>
                    <div class="col-lg-3 col-md-12 mt-3 ">
                        <a href="../club-home/development-leaders-club.html">
                            <div class="over-container">
                                <img src="../public/upload/banner/20230727_1690477601432.png"
                                     style="height: 242px; object-fit:cover;"
                                     onerror="this.onerror=null;this.src='../public/upload/no-image.png';"
                                     class=" shadow-1-strong  over-img" alt="Student Life"/>
                                <div class="position-absolute campus-title" style="right:0px; bottom:20px">
                                    <div class=" text-white d-flex justify-content-center"
                                         style="width: 200px; height: 40px; background: #B60404; box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);">
                                        <p class="mt-2 text-right"> Development Leader... </p>
                                    </div>
                                </div>
                                <div class="overlay">
                                    <div class="text">Development Leaders Club</div>
                                </div>
                            </div>
                        </a>
                    </div>
                    <div class="col-lg-3 col-md-12 mt-3 ">
                        <a href="../club-home/bup-research-society.html">
                            <div class="over-container">
                                <img src="../public/upload/banner/20230803_1691047429673.png"
                                     style="height: 242px; object-fit:cover;"
                                     onerror="this.onerror=null;this.src='../public/upload/no-image.png';"
                                     class=" shadow-1-strong  over-img" alt="Student Life"/>
                                <div class="position-absolute campus-title" style="right:0px; bottom:20px">
                                    <div class=" text-white d-flex justify-content-center"
                                         style="width: 200px; height: 40px; background: #B60404; box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);">
                                        <p class="mt-2 text-right"> BUP Research Socie... </p>
                                    </div>
                                </div>
                                <div class="overlay">
                                    <div class="text">BUP Research Society</div>
                                </div>
                            </div>
                        </a>
                    </div>
                    <div class="col-lg-3 col-md-12 mt-3 ">
                        <a href="../club-home/bup-debate-club.html">
                            <div class="over-container">
                                <img src="../public/upload/banner/20230803_1691047491129.jpg"
                                     style="height: 242px; object-fit:cover;"
                                     onerror="this.onerror=null;this.src='../public/upload/no-image.png';"
                                     class=" shadow-1-strong  over-img" alt="Student Life"/>
                                <div class="position-absolute campus-title" style="right:0px; bottom:20px">
                                    <div class=" text-white d-flex justify-content-center"
                                         style="width: 200px; height: 40px; background: #B60404; box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);">
                                        <p class="mt-2 text-right"> BUP Debate Club </p>
                                    </div>
                                </div>
                                <div class="overlay">
                                    <div class="text">BUP Debate Club</div>
                                </div>
                            </div>
                        </a>
                    </div>
                    <div class="col-lg-3 col-md-12 mt-3 ">
                        <a href="../club-home/bup-literature-drama-club.html">
                            <div class="over-container">
                                <img src="../public/upload/banner/20231015_1697370974299.jpg"
                                     style="height: 242px; object-fit:cover;"
                                     onerror="this.onerror=null;this.src='../public/upload/no-image.png';"
                                     class=" shadow-1-strong  over-img" alt="Student Life"/>
                                <div class="position-absolute campus-title" style="right:0px; bottom:20px">
                                    <div class=" text-white d-flex justify-content-center"
                                         style="width: 200px; height: 40px; background: #B60404; box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);">
                                        <p class="mt-2 text-right"> BUP Literature &amp; D... </p>
                                    </div>
                                </div>
                                <div class="overlay">
                                    <div class="text">BUP Literature &amp; Drama Club</div>
                                </div>
                            </div>
                        </a>
                    </div>

                </div>
            </div>
        </div>
    </section>


<?php get_footer() ?>