<?php
  if(stripos($_SERVER['SCRIPT_NAME'],"/admin/")===false?false:true){
	?>
		<div class="modal fade" id="commissionHistorySelectPeriod" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog modal-sm">
			  <div class="modal-content">
				<div class="modal-header">
				  <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
				  <h4 class="modal-title">Select Period</h4>
				</div>
				<div class="modal-body">
				  <form>
				  <div class="form-group">
					  <label for="paymentHistorySelectPeriodFrom">From Period:</label>
						  <input class="form-control" type="month" name="paymentHistorySelectPeriodFrom" id="paymentHistorySelectPeriodFrom" value="<?= date('Y-m', time()-30*24*60*60) ?>">
				  </div>
				  <div class="form-group">
					  <label for="paymentHistorySelectPeriodTo">To Period:</label>
						  <input class="form-control" type="month" name="paymentHistorySelectPeriodTo" id="paymentHistorySelectPeriodTo" value="<?= date('Y-m', time()-30*24*60*60) ?>">
				  </div>
				  </form>
				</div>
				<div class="modal-footer">
				  <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
				  <button type="button" id="commissionHistorySelectPeriodGo" class="btn btn-primary">Go</button>
				</div>
			  </div>
			</div>
		  </div>
		<script type="text/javascript">
			$('#commissionHistorySelectPeriodGo').on('click', function(){
					var fromPeriod = $('#paymentHistorySelectPeriodFrom').val();
					var toPeriod = $('#paymentHistorySelectPeriodTo').val();
					window.location = 'mod.php?p=commission&a=viewhistory&from=' + fromPeriod + '&to=' + toPeriod;
					
				});
		</script>
	
	<?php	
		}
	?>
	
		
		
		