<?php
if ($this->searchTitle) {
    $title="Checked Out Releases";
} else {
    $title="Releases";
}
$checkoutRelease = $this->url(array("module" => "oa", "controller" => "relationships", "action" => "updatereleaseapprovalqueuestatus","updateStatus"=>"checkout"));
$checkinURL = $this->url(array("module" => "oa", "controller" => "relationships", "action" => "updatereleaseapprovalqueuestatus", "updateStatus" => "checkin","pageType"=>"myBatch"));
$totalPageRecord = !empty($this->releases) ? count($this->releases) : 0;

$theQueryString = "release_name=".urlencode($this->release_name)."&artist_name=".urlencode($this->artist_name)
                ."&label=".urlencode($this->label)."&date_submitted=".urlencode($this->date_submitted)
                ."&varSubmissionType=".urlencode($this->varSubmissionType)."&varAssetType=".urlencode($this->varAssetType)
                ."&numberCheckout=".urlencode($this->numberCheckout);

?>
<b class="errormsgForRelease"></b>
<form action="" method="post" name="checkoutReleaseForm" id="checkoutReleaseForm">
<input type="hidden" id="chkOutUrl" value="<?php echo $checkoutRelease;?>"></input>
<input type="hidden" id="chkInUrl" value="<?php echo $checkinURL;?>"></input>
<input type="hidden" name="page" id="page" value="<?php echo $this->page;?>" />
<input type="hidden" name="pageRecord" id="pageRecord" value="<?php echo $this->pageRecord;?>" />
<input type="hidden" name="userId" id="userId" value="<?=$this->userId ?>">
<input type="hidden" name="pageType" id="pageType" value="<?php  echo (($this->searchTitle) ? 'myBatch' : 'releases');?>" />
    <div class="panelHeader">
        <h3><?php echo $title;?></h3>
    </div>
    <div class="panelContent zero-margin-bottom">
        <table class="table table-input-select text-nowrap table-sorter">
            <thead>
                <tr>
                    <th class="rowSelect">
                        <div class="checkbox">
                            <input type="checkbox" id="selectAll" name="selectAll" <?php echo (($this->searchTitle) ? 'checked="checked"' :'');?>></input>
                            <label for="selectAll"></label>
                        </div>
                    </th>
                    <th class="rowSelect" width="10">#</th>
                    <th class="rowSelect">Sales Start Date</th>
                    <th class="rowSelect">Pre Order Date</th>
                    <th class="rowSelect">Date Submitted</th>
                    <th class="rowSelect">Entry Date</th>
                    <th class="rowSelect">Release Name</th>
                    <th class="rowSelect">Artist</th>
                    <?php if (!$this->searchTitle) { ?>
                        <th class="rowSelect">Imprint</th>
                    <?php } ?>
                    <th class="rowSelect">Submission Type</th>
                    <th class="rowSelect">UPC</th>
                    <?php if (!$this->searchTitle) { ?>
                        <th class="rowSelect">Asset Type</th>
                        <th class="rowSelect">Assigned To</th>
                        <th class="rowSelect">Checked Out By</th>
                    <?php } ?>
                    <th class="rowSelect">Label ID</th>
                    <th class="header">Label</th>
                </tr>
            </thead>
            <tbody id="result">
            </tbody>
        </table>
    </div>
    <div class="panelButtons full-width table-button-section" id="panelButtonReleaseList"> </div>
    <div id="divPagination"></div>
</form>
<script>
$(function(){
    // add multiple select / deselect functionality
    $("#selectAll").click(function () {
          $('.case').attr('checked', this.checked);
          $('.checkHidden').attr('checked', this.checked);
    });
});

$('.table-sorter').tablesorter({
    headers: {
        0: {
            sorter: false
        }
    }
});

$(document).ajaxComplete(function () {
    $.fn.tableInputCheckbox();
    $('.table-sorter').trigger('update');
});

</script>
