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

#messageView {
    z-index: 1110!important; /* must set here to let date picker display on top */
}

#jobDetailView {
    z-index: 1110!important; /* must set here to let date picker display on top */
}

#jobAssignAttachmentView {
    z-index: 1110!important; /* must set here to let date picker display on top */
}

#AgentStatus {
    z-index: 1110!important; /* must set here to let date picker display on top */
}

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

#calendar-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

</style>

</head>
<!-- Add Project Modal HTML -->

<div id="addJobCentreView" class="modal fade" style="overflow: auto;overflow-y: scroll;" tabindex="-1" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog" style="width: 95%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="return cancelDoc();">&times;</button>
                <h4 class="modal-title">Job Plan</h4>
            </div>
            <div class="modal-body">
	            <div id="modalAddJobCentreHeaderViewContent">
	        	</div>
            </div>
            <div class="modal-footer">
            	<div id="modalAddJobCentreHeaderViewButtonContent">
			   </div>
            </div>
        </div>
    </div>
</div>

<!-- Upload Document Modal HTML -->
<div id="uploadDocJobCentreView" class="modal fade" style="overflow: auto;overflow-y: scroll;">
    <div class="modal-dialog" style="width: 764px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Document Detail</h4>
            </div>
            
            <div class="modal-body">
                <div id="modaluploadDocJobCentreContent">
                </div>
            </div>
            
            <div class="modal-footer">
                <div id="modaluploadDocJobCentreButtonContent">
               </div>
            </div>
        </div>
    </div>
</div>
  
<!-- Project Report Utilization Modal HTML -->
<div id="printJobCentreReportUtilizationView" class="modal fade" style="overflow: auto;overflow-y: scroll;" tabindex="-1" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog" style="width: 80%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 id="modalJobCentreReportUtilizationHeaderViewContent" class="modal-title">Job Utilization</h4>
            </div>
            <div class="modal-body" id="modalJobCentreReportUtilizationViewContent">
            </div>
            <div class="modal-footer" id="modalJobCentreReportUtilizationFooter">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

<!-- message Modal HTML -->
<div id="messageView" class="modal fade" style="overflow: auto;overflow-y: scroll;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header" id="modalMessageHeaderContent">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="modalMessageViewTitle" >Message</h4>
            </div>
            
            <div class="modal-body">
	            <div id="modalMessageViewContent">
	        	</div>
            </div>
            
            <div class="modal-footer">
            	<div id="modalMessageButtonContent">
            		<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
			   </div>
            </div>
        </div>
    </div>
</div>


<!-- Job Assignment List Modal HTML -->
<div id="addJobAssignmentView" class="modal fade" style="overflow: auto;overflow-y: scroll;" tabindex="-1" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog" style="width: 95%;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Job Assignment</h4>
            </div>
            <div class="modal-body">
                <div id="modalAddJobAssignmentHeaderViewContent">
                </div>
            </div>
            <div class="modal-footer">
                <div id="modalAddJobAssignmentHeaderViewButtonContent">
                </div>
            </div>
        </div>
    </div>
</div>

<!-- message Modal HTML -->
<div id="jobDetailView" class="modal fade" style="overflow: auto;overflow-y: scroll;"  >
    <div class="modal-dialog" style="width: 60%;">
        <div class="modal-content">
            <div class="modal-header" id="modalMessageHeaderContent">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="modalMessageViewTitle" >Job Detail</h4>
            </div>
            
            <div class="modal-body">
                <div id="jobDetailViewViewContent">
                </div>
            </div>
            
            <div class="modal-footer">
                <div id="jobDetailViewButtonContent">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
               </div>
            </div>
        </div>
    </div>
</div>

<!-- confirmation message Modal HTML -->
<div id="agentSchedule4" class="modal fade" style="overflow: auto;overflow-y: scroll;" tabindex="-1">
    <div class="modal-dialog" style="width: 80%;">
        <div class="modal-content">
            <div class="modal-header" id="modalConfirmationMessageHeaderContent">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="modalConfirmationMessageViewTitle" >Schedule</h4>
            </div>
            
            <div class="modal-body" style="overflow: auto;overflow-y: scroll;" >
                <div id="modalConfirmationMessageViewContent">
                    <div class="row" style="text-align: center">
                        <div class="col-sm-1">
                            <select id="cobSchMonth4" class="form-control" onchange="showAgentSchedule4();">
                                <?php echo $this->getSchMonth(); ?>
                            </select>
                        </div>
                        <div class="col-sm-1">
                            <select id="cobSchYear4" class="form-control" onchange="showAgentSchedule4();">
                                <?php echo $this->getSchYear(); ?>
                            </select>
                        </div>
                        <div class="col-sm-2">
                            <select id="cobSchAgent4" class="form-control" onchange="showAgentSchedule4();">
                                <?php echo $this->getUserOption(); ?>
                            </select>
                        </div>
                    </div>
               
                    <div class="row" style="margin-top: 3%;" >
                        <div id='calendar'></div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <div id="modalcCnfirmationMessageButtonContent">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
               </div>
            </div>
        </div>
    </div>
</div> 

<!-- agent status -->
<div id="AgentStatus" class="modal fade" style="overflow: auto;overflow-y: scroll;"  >
    <div class="modal-dialog" style="width: 40%;">
        <div class="modal-content">
            <div class="modal-header" id="modalMessageHeaderContent">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="modalMessageViewTitle" >Agent Status Detail</h4>
            </div>
            
            <div class="modal-body">
                <div id="AgentStatusViewContent">
                </div>
            </div>
            
            <div class="modal-footer">
                <div id="AgentStatusButtonContent">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
               </div>
            </div>
        </div>
    </div>
</div>

<!-- Submit pop up Modal HTML -->
<div id="deleteJobAssignmentConfirmationView" class="modal fade" style="overflow: auto;overflow-y: scroll;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="modalDeleteJobAssignmentConfirmationTitle">Confirm Job Assignment Deletion</h4>
            </div>
            
            <div class="modal-body">
                <div id="modalDeleteJobAssignmentConfirmationContent">
                
                </div>
            </div>
            
            <div class="modal-footer">
                <div id="modalDeleteJobAssignmentConfirmationButton">
               </div>
            </div>
        </div>
    </div>
</div>

<!-- attachment modal -->
<div id="jobAssignAttachmentView" class="modal fade" style="overflow: auto;overflow-y: scroll;">
    <div class="modal-dialog" style="width: 764px">
        <div class="modal-content">
            <div class="modal-header" id="jobAssignAttachmentHeader" style="background-color:#31B0D5">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="requestApprovalAdditionalAttachmentTitle" >Additional Attachment</h4>
            </div>
            <div class="modal-body">
                <div id="jobAssignAttachmentContent">
                </div>
            </div>
            <div class="modal-footer" style="padding:5px">
                <div id="jobAssignAttachmentButton">
                </div>
            </div>
        </div>
    </div>
</div>

<!-- save template pop up Modal HTML -->
<div id="SaveJobPlanTemplateConfirmationView" class="modal fade" style="overflow: auto;overflow-y: scroll;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="modalSaveJobPlanTemplateConfirmationTitle">Save Job Plan Template</h4>
            </div>
            
            <div class="modal-body">
                <div class="row">
                    <div id="modalSaveJobPlanTemplateConfirmationContent" >
                            <div class="col-md-6">
                                <input  type="text" class="form-control" id="JobPlanTemplateName" placeholder="Template Name ">
                            </div>
                    </div>
                </div>
	            
            </div>
            
            <div class="modal-footer">
            	<div id="modalSaveJobPlanTemplateConfirmationButton">
			   </div>
            </div>
        </div>
    </div>
</div>

<!-- Load template pop up Modal HTML -->
<div id="LoadJobPlanTemplateConfirmationView" class="modal fade" style="overflow: auto;overflow-y: scroll;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="modalLoadJobPlanTemplateConfirmationTitle">Load Job Plan Template</h4>
            </div>
            
            <div class="modal-body">
                <div class="row">
                    <div id="modalLoadJobPlanTemplateConfirmationContent" >
                            <div class="col-md-6">
                                <select class="form-control" id="JobPlanTemplateLoad"></select>
                            </div>
                    </div>
                </div>
	            
            </div>
            
            <div class="modal-footer">
            	<div id="modalLoadJobPlanTemplateConfirmationButton">
			   </div>
            </div>
        </div>
    </div>
</div>

<!-- confirmation message Modal HTML -->
<div id="confirmationMessageView" class="modal fade" style="overflow: auto;overflow-y: scroll;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header" id="modalConfirmationMessageHeaderContent">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="modalConfirmationMessageViewTitle" >Message</h4>
            </div>
            
            <div class="modal-body">
	            <div id="modalConfirmationMessageViewContent">
	        	</div>
            </div>
            <div class="modal-footer">
            	<div id="modalcCnfirmationMessageButtonContent">
            		<button type="button" class="btn btn-default" data-dismiss="modal">Yes</button>
			   </div>
            </div>
        </div>
    </div>
</div>


<div class="modal fade" id="activityLoadingModal" tabindex="-1" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="modalLoadingTitle">Processing...</h4>
            </div>
            <div class="modal-body">
                <div class="progress progress-striped active">
                    <div class="progress-bar" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width:100%">
                        <span class="sr-only">70% Complete</span>
                      </div>
                </div>
            </div>
        </div>
    </div>
</div>


<!-- Submit pop up Modal HTML -->
<div id="deleteJobCentreConfirmationView" class="modal fade" style="overflow: auto;overflow-y: scroll;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="modalDeleteJobCentreConfirmationTitle">Confirm Job Plan Deletion</h4>
            </div>
            
            <div class="modal-body">
	            <div id="modalDeleteJobCentreConfirmationContent">
	            
	        	</div>
            </div>
            
            <div class="modal-footer">
            	<div id="modalDeleteJobCentreConfirmationButton">
			   </div>
            </div>
        </div>
    </div>
</div>

<!-- Submit confirmation pop up Modal HTML -->
<div id="saveJobCentreConfirmationView" class="modal fade" style="overflow: auto;overflow-y: scroll;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div style="background-color:orange;" class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="modalSaveJobCentreConfirmationTitle">Confirmation Save Job Centre</h4>
            </div>
            
            <div class="modal-body">
                <div id="modalSaveJobCentreConfirmationContent">
                
                </div>
            </div>
            
            <div class="modal-footer">
                <div id="modalSaveJobCentreConfirmationButton">
               </div>
            </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">
        <select style="height: 30px;" id="filterJobTypeCentre" >
            <?php echo $this->getJobTypeFilter(); ?>
        </select>
    </div>
    <div class="filter-unit">
        <input  style="height: 30px;"  type="text" placeholder="Job Title" id="filterTitleJobCentre">
    </div>
    <div class="filter-unit" style="display:none;">
        <input  style="height: 30px;"  type="text" placeholder="Customer Code" id="filterCustCodeJobCentre">
    </div>
    <div class="filter-unit">
        <input  style="height: 30px;"  type="text" placeholder="Customer Name" id="filterCustomerJobCentre">
    </div>
    <div class="filter-unit">
        <select style="height: 30px;" id="filterJobCentreStatus" >
            <?php echo $this->getJobStatusFilter(); ?>
        </select>
    </div>
    <div class="filter-unit">
        <a href="#" onclick="return filterJobCentre();" class="btn btn-primary btn-sm"><span class="fa fa-plus"></span> Filter</a>
    </div>

    
	<?php if(!isset($isManagerFilter) || $isManagerFilter == false) { ?>
    <div class="claim-btn" style="display: none;">
        <table>
            <tr>
                <td>
                    <div>
                        <a onclick="return showAddJobCentre();" role="button" class="btn btn-primary btn-sm" data-toggle="modal"><span class="glyphicon glyphicon-plus"></span> Add</a>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <?php } ?>

	<div class="filter-unit"> 
		<!-- <a href="#" onclick="return filterTaskSchedule();" class="btn btn-primary btn-sm"><span class="fa fa-plus"></span> Filter</a> -->
	</div>
	<?php if(!isset($isManagerFilter) || $isManagerFilter == false) { ?>
	<div class="claim-btn">
		<table>
			<tr>
				<td style="text-align:right;display:none">
				</td>
			</tr>
		</table>
	</div>
	<?php } ?>
</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" style="width: 100%; max-width: 100%; margin-bottom: 20px;" id="job-centre-table">
		</table>
	</div>
</div>


<script>
$(document).ready(function () {
	filterJobCentre();
    getJobCentreAutoSearch();
});
</script>

<script>
$(document).ready(function () {
    var claimDayLast = 30;
    if(!isNaN($('#txtClaimDayLast').val()))
        claimDayLast = parseInt($('#txtClaimDayLast').val());
    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));

    var n = todayDate.getMonth();
    $('#cobSchMonth4').val(n+1);

    firstDay.setFullYear(date.getFullYear(), date.getMonth(), 1);
    lastDay.setFullYear(date.getFullYear(), date.getMonth() + 1, 0);
});
</script>
<script>

      document.addEventListener('DOMContentLoaded', function() {
        var calendarEl = document.getElementById('calendar');

        var calendar = new FullCalendar.Calendar(calendarEl, {
          plugins: [ 'dayGridMonth' ]
        });

        calendar.render();
      });

    </script>