<?php
    if(!defined('ABSPATH')){
        exit; // Exit if accessed directly
    }
?>

<table class="table table-striped" id="egps_admin_album_table">
    <thead>
    <tr>
        <th scope="col">#</th>
        <th scope="col">Image</th>
        <th scope="col">Details</th>
        <th scope="col">Visible/Hidden</th>
        <th scope="col">Title</th>
        <th scope="col">All items</th>
        <th scope="col">Exclusive items</th>
    </tr>
    </thead>
    <tbody>
    <?php

    $i = 1;

    foreach ($album_data_array as $item){
        echo '<tr>';

        echo '<td>' . esc_html($i++) . '.</td>';
        echo '<td>
        <a href="'. esc_html(get_site_url()).'/wp-admin/admin.php?page=easy-photo-sell_albums&show_album_photos=' . esc_html($item->egps_id) . '" 
            id="egps_album_photos_' . esc_html($item->egps_id) . '" 
            class="btn btn-outline-primary" 
            >
            <img src="' . esc_html(get_site_url()) . '/wp-content/uploads/egps/photos/' . esc_html($item->egps_id) . '.jpg' . '" width="150" /></td>';
        echo '</a>';

        echo '<td>
        <a href="'.esc_html(get_site_url()).'/wp-admin/admin.php?page=easy-photo-sell_albums&show_album_photos=' . esc_html($item->egps_id) . '" 
            id="egps_album_photos_' . esc_html($item->egps_id) . '" 
            class="btn btn-outline-secondary" 
            >
            Album photos</a>
        </td>';

        if($item->egps_album_show == 'y'){
            echo '<td><button id="egps_show_' . esc_html($item->id) . '" type="button" class="btn btn-success egps_showhidebtn" value="n">Visible</button></td>';
        }else{
            echo '<td><button id="egps_show_' . esc_html($item->id) . '" type="button" class="btn btn-outline-danger egps_showhidebtn" value="y">Hidden</button></td>';
        }

        echo '<!--<td>
                    <div class="progress" style="margin-top:100px">
                        <div class="progress-bar active" id="progressbar_' . esc_html($item->egps_id) . '" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 0%; background-color: #399;">
                            <span class="sr-only">0% Complete</span>
                        </div>
                    </div>
              </td>-->';
        echo '<td>' . esc_html($item->egps_title) . '</td>';
        echo '<td>' . esc_html($item->egps_mediaItemsCount) . '</td>';
        echo '<td>' . esc_html($item->egps_exclusiveCount) . '</td>';

        echo '</tr>';
    }

    $egps_normalcount = EgpsAlbums::egps_show_photo_count("", "egps_mediaItemsCount");
    $egps_excount = EgpsAlbums::egps_show_photo_count("", "egps_exclusiveCount");

    echo '<tr>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td>SUM: </td>
            <td>' . esc_html($egps_normalcount) . '</td>
            <td> ' . esc_html($egps_excount) . '</td>
        </tr>';

    ?>

    </tbody>
</table>


