<?php
    $title = 'Royalty Collections Track Blacklist';
    $totalPageRecord = count($this->blackList ?? []);
    $thePage = $this->page;
    $thePageRecord = $this->pageRecord;
    $theTotalRecord = $this->countblackList;
    $theTotalPage = ceil($theTotalRecord / $thePageRecord);
?>
<div>
    <?php
    if ($this->errorMsg != '') { ?>
        <div id="error" class="alertError" style="display:block;margin-bottom:5px;">
            <?=$this->errorMsg; ?>
        </div>
    <?php 
    }
    $this->placeholder('breadcrumb')->set('<a href="/relationships.php">Relationships</a> > Royalty Collections Track Blacklist');
    ?>
    <div class="panelHeader">
        <h3><?=$title?></h3>
    </div>
    <div class="panelContent">
        <form name="royality_collection_form" action="/relationships/royalitycollectionblacklist/" method="post">
            <div>
                <table class="data">
                    <tr>
                        <th> Track ID</th>
                        <th class="center"> Reason</th>
                    </tr>
                    <tr>
                        <td> * Track ID(s) Separated by line breaks<br><textarea name="track_ids"><?=(isset($this->track_ids)?$this->track_ids:"")?></textarea></td>
                        <td><br><textarea name="reason"><?=(isset($this->reason)?$this->reason:"")?></textarea></td>
                    </tr>
                    <tr>
                        <td colspan="4" align="right">
                            <input type="submit" class="btn btn-sm btn-primary" value="Submit"> 
                            <input type="reset" value="Cancel" class="btn btn-default btn-sm">
                        </td>
                    </tr>
                </table>
            </div>
        </form>
    </div>
    <?php 
        echo $this->partial("/relationships/_searchtrackblacklist.phtml",$this);
        echo $this->partial("/relationships/_viewtrackblacklist.phtml",$this);
    ?>
    <input type="hidden" name="page" id="page" value="<?php echo $this->page;?>" />
    <input type="hidden" name="pageRecord" id="pageRecord" value="<?php echo $this->pageRecord;?>" />
</div>
<script type="text/javascript">
$(window).bind('load', function() {
    displayTrackBlackList();
});
$(document).bind('GET_RELEASE_AFTER_PAGINATION', function(e, data){
    $('#page').val(data);
    displayTrackBlackList();
});
$(document).bind('CHANGE_PAGERECORDS_PAGINATION', function(e, data){
    $('#page').val(1);
    $("#pageRecord").val(data);
    displayTrackBlackList();
});
</script>
