<head>
<style type="text/css">
button {
    margin-left: 2px;
    margin-right: 2px;
}

.modal-header {
    background-color: #3c8dbc;
    color: white;
}

</style>
</head>
<!-- Report Modal HTML -->
<div id="printReportView" class="modal fade" style="overflow: auto;overflow-y: scroll;" tabindex="-1" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog" style="width: 60%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 id="modalReportHeaderViewContent" class="modal-title">Job Status Summary Report</h4>
            </div>
            <div class="modal-body" id="modalReportViewContent"></div>
            <div class="modal-footer" id="modalReportFooter">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

<input type="hidden" id="isManagerFilter" value="<?php echo isset($isManagerFilter) ? ($isManagerFilter ? 'true' : 'false' ) : 'false';?>" >

<div class="col-md-12" <?php echo isset($isManagerFilter) && $isManagerFilter ? "style='display:none'" : ''; ?>>
    <div class="filter-unit">
        <input  style="height: 30px;"  type="text" placeholder="From Date" id="txtFromDateFilter" size=10>
    </div>
    <div class="filter-unit">
        <input style="height: 30px;" type="text" placeholder="To Date" id="txtToDateFilter" size=10>
    </div>
    <div class="filter-unit" style="display:none;">
        <select style="height: 30px;" id="cmbTypeFilter"><?php echo $this->getOptionJobType(1); ?></select>
    </div>
    <div class="filter-unit">
        <select style="height: 30px;" id="cmbCompanyFilter"><?php echo $this->getOptionCompany(); ?></select>
    </div>
    <div class="filter-unit">
        <input  style="height: 30px;" type="text" placeholder="Customer Name" id="txtCustomerFilter">
    </div>
    <div class="filter-unit">
        <input  style="height: 30px;" type="text" placeholder="Job No" id="txtJobNoFilter" value="">
    </div>
    <div class="filter-unit">
        <a href="#" onclick='return filterReport("<?php echo Command::PortalReportPlanScheduleSummaryFilter; ?>");' class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-plus"></span> Filter</a>
    </div>
    <div class="filter-unit">
        <a href="#" id="btnPrintPreview" onclick='return showReportPrintPreview("<?php echo Command::PortalReportPlanScheduleSummaryPrintPreview; ?>",0);' class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-print"></span> Print</a>
    </div>
</div>

<div class="col-md-12" id="errorShow"></div>

<div class="col-md-12" style="margin-top: 20px">
    <div class="box" id="testData">
        <table class="table table-striped" style="width: 100%; max-width: 100%; margin-bottom: 20px;" id="report-table">
        </table>
    </div>
</div>
<script type ="text/javascript">
$(document).ready(function() {
    var claimDayLast = 30;
    var date = new Date();
    var firstDay = new Date();
    var lastDay = new Date();
    var todayDate = new Date();
    var startDate = new Date(new Date().setDate(todayDate.getDate()-claimDayLast));
    
    firstDay.setFullYear(date.getFullYear(), date.getMonth(), 1);
    lastDay.setFullYear(date.getFullYear(), date.getMonth() + 1, 0);

    $('#txtFromDateFilter').datepicker({
        format: "dd/mm/yyyy"
    }); 
    $('#txtFromDateFilter').on('changeDate', function(ev){
        $(this).datepicker('hide');
    });
    
    $('#txtToDateFilter').datepicker({
        format: "dd/mm/yyyy"
    });

    $('#txtToDateFilter').on('changeDate', function(ev){
        $(this).datepicker('hide');
    });

    
    // last xx days
    $('#txtFromDateFilter').datepicker('setValue', (startDate.getDate() <= 9 ? "0" + startDate.getDate() : startDate.getDate()) + "/" + (startDate.getMonth()+1 <= 9 ? "0" + (startDate.getMonth()+1) : (startDate.getMonth()+1) ) + "/" + startDate.getFullYear());
    $('#txtToDateFilter').datepicker('setValue', (todayDate.getDate() <= 9 ? "0" + todayDate.getDate() : todayDate.getDate()) + "/" + (todayDate.getMonth()+1 <= 9 ? "0" + (todayDate.getMonth()+1) : (todayDate.getMonth()+1) ) + "/" + todayDate.getFullYear());
    
    filterReport("<?php echo Command::PortalReportPlanScheduleSummaryFilter; ?>");
	getReportAutoSearch("C_SEARCH");
});
</script>