<? global $vis_language;
$schedule=array(0=>'Once',1=>'Daily', 2=>'Weekly', 3=>'Monthly', 4=>'Quaterly',5=>'Yearly');
		/*$send_email	=	$ticket_schedule_data['send_email'];
		$auto_responder		= $ticket_schedule_data['auto_responder'];*/
	
?> 
<div class="modal-dialog">
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal">&times;</button>
      <h4 class="modal-title"><? echo $message_info['vis_form_title']; ?></h4>
    </div>
    <div class="modal-body">
	<div class="row">
		<div class="col-sm-12 form-horizontal">
		<div class="form-group">
		
			<label class="col-sm-3 control-label"><? echo $vis_language['TXTREPORTTITLE']; ?></label>
			<div class="col-sm-9">                                
				<input class="form-control input-sm"  type="text" name="vis_filename" id="vis_filename" value="<? echo (isset($operation['vis_title']))?$operation['vis_title']:'';?>"/>
			</div>
			
        </div>
		
		<div class="form-group">
			<label class="col-sm-3 control-label"><? echo $vis_language['TXTREPEATSCHEDULE']; ?></label>
			<div class="col-sm-9">                                
				 <select class="form-control input-sm selectpicker" id="vis_set_schedule" name="vis_set_schedule" onchange="">
                                    <?
                                       for($i=0;$i<count($schedule);$i++) {
                                       if($schedule_type == $i) $selected='selected="selected"'; else $selected='';
                                       echo '<option value="'.$i.'" '.$selected.' >'.$schedule[$i].'</option>'; } ?>
                                    </select>
			</div>
			
        </div>
        
         <div class="form-group">
			<label class="col-sm-3 control-label"><?  echo $vis_language['TXTSTARTDATE'];?></label>
			<div class="col-sm-9">                                
				 <span class="input-group-addon no-padder no-borders start">  <input class="input-sm form-control" id="vis_schedule_start_date" name="vis_schedule_start_date" size="16" type="text" placeholder="<?php echo strtoupper(VIS_DATETIME_FORMAT);?>" value="<?= $startdate; ?>"></span>
				 
			</div>		
        </div>
        
     
        <div class="form-group" id="end_dt"> 
			<label class="col-sm-3 control-label"><?  echo $vis_language['TXTENDDATE'];?></label>
			<div class="col-sm-9">                                
				<span class="input-group-addon no-padder no-borders start">  <input class="input-sm form-control" id="vis_schedule_end_date" name="vis_schedule_end_date" size="16" type="text" placeholder="<?php echo strtoupper(VIS_DATETIME_FORMAT);?>" value="<?= $enddate; ?>"></span>
			</div>		
        </div>
       
         <div class="form-group">
			<label class="col-sm-3 control-label"><? echo $vis_language['TXTEXPORTTYPE']; ?></label>
			<div class="col-sm-9">                                
				<select name="vis_exporttype" id="vis_exporttype" class="form-control input-sm selectpicker">
                     <option value="1">CSV</option>
                     <option value="2">HTML</option>
                     <option value="3">XLSX</option>
                  </select>
			</div>		
        </div>
        
        <div class="form-group">
			<label class="col-sm-3 control-label"><? echo $vis_language['TXTSENDEMAIL']; ?></label>
			<div class="col-sm-9">
				 <label class="checkbox-inline i-checks">
                      <input type="checkbox" value="1" id="vis_sendemail" name="vis_sendemail"  onchange="toggle_email(this);" <? if($request_report['send_email']==1) echo ' checked="checked"'; ?>><i></i>
                     
                      </label>
			</div>
			</div>
        
        <div class="form-group" id="vis_emailid" style="display:none;">
			<label class="col-sm-3 control-label"><? echo $vis_language['TXTTOEMAIL']; ?></label>
			<div class="col-sm-9">                                
				<input class="form-control input-sm"  type="text" name="vis_toemail" id="vis_toemail"/>
			</div>
			
        </div>
        
        </div>
	</div>	
	</div>
    <div class="modal-footer">
		<a class="btn btn-default" data-dismiss="modal"><? echo $vis_language['TXTCANCEL']; ?></a>
			
		<a class="btn btn-primary" onclick="$('#vis_workpanel_div').visExecution('submit_form',{'vis_module':'report', 'vis_operation':'request_schedule_report','vis_form':'vis_<?= $operation['vis_operation'] ?>_frm','report_title': $('#vis_filename').val(),'schedule_type': $('#vis_set_schedule').val(),'start_date': $('#vis_schedule_start_date').val(),'end_date': $('#vis_schedule_end_date').val(),'export_type': $('#vis_exporttype').val(),'duration':'<? echo $operation['duration'];?>','from_date':'<? echo $operation['from_date'];?>','to_date':'<? echo $operation['to_date']; ?>','staff_id':'<? echo $operation['staff_id'];?>','department_id':'<? echo $operation['department_id'];?>','flag_id':'<? echo $operation['flag_id'];?>','client_id':'<? echo $operation['client_id'];?>','group_id':'<? echo $operation['group_id'];?>','domain_id':'<? echo $operation['domain_id'];?>','quest_id':'<? echo $operation['quest_id'];?>','maxcount':'<? echo $operation['maxcount']?>','vis_new_ticket_list_client1':'<? echo $operation['vis_new_ticket_list_client1'];?>','vis_new_ticket_list_client':'<? echo urlencode($operation['vis_new_ticket_list_client']);?>','survey_id':'<? echo $operation['survey_id'];?>','link_type':'<? echo $operation['link_type']?>','vis_client_id':'<? echo $operation['vis_client_id'];?>','vis_criteria':'<? echo $operation['vis_criteria'];?>','vis_status_condition':'<? echo $operation['vis_status_condition'];?>','vis_status':'<?echo $operation['vis_status'];?>','vis_priority_condition':'<? echo $operation['vis_priority_condition'];?>','vis_priority':'<? echo $operation['vis_priority'];?>','asset_name':'<? echo $operation['asset_name'];?>','vis_asset_id':'<?echo $operation['vis_asset_id']; ?>','vis_impact_condition':'<? echo $operation['vis_impact_condition'];?>','vis_impact':'<? echo $operation['vis_impact']?>','vis_criteria':'<? echo $operation['vis_criteria'];?>','userfield_name':'<? echo $operation['userfield_name'];?>','channel_id':'<? echo $operation['channel_id'];?>','location_id':'<? echo $operation['location_id'];?>','report_type':'<? echo $operation['report_type'];?>','send_email':($('#vis_sendemail').is(':checked'))?$('#vis_sendemail').val():0,'email_id':$('#vis_toemail').val(),'vis_filter_id':'<? echo $operation['vis_filter_id'];?>','creation_date':'<? echo $operation['creation_date'];?>','report_filter':'<? echo $operation['report_filter'];?>','vis_client_start':'<? echo $operation['start_char'];?>'});"><? echo $vis_language['TXTOK']; ?></a>
    </div>
  </div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
<script>
function toggle_email(e) {
	 if($('#vis_sendemail').is(":checked")) $('#vis_emailid').show();
       else $('#vis_emailid').hide();
}
//$("#end_dt").hide();
function show_hide_enddate(){ 
		if($("#vis_set_schedule").val()==0){ 
			$("#end_dt").hide();
		
		}else{
			$("#end_dt").show();
				
		}
	}		
$('.start').datetimepicker({
	
        format: "<?php echo VIS_DATETIMEPICKER_FORMAT;?>"
         
	});	
</script>
