
<? global $vis_language;
$schedule=array(0=>'Once',1=>'Daily', 2=>'Weekly', 3=>'Monthly', 4=>'Quaterly',5=>'Yearly');
$export=array(1=>'CSV', 2=>'HTML',3=>'XLSX');

		/*$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 $download_list[0]['report_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($download_list[0]['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="DD-MM-YYYY" value="<?echo format_datetime(($download_list[0]['start_date'])-(VIS_TIMEZONE));  ?>"></span>
				 <input class="form-control input-sm"  type="hidden" name="vis_hidden_schedule_start_date" id="vis_hidden_schedule_start_date" value="<? echo $download_list[0]['start_date']; ?>"/>
			</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="DD-MM-YYYY" value="<? echo format_datetime(($download_list[0]['end_date'])-(VIS_TIMEZONE)); ?>"></span>
				 <input class="form-control input-sm"  type="hidden" name="vis_hidden_schedule_end_date" id="vis_hidden_schedule_end_date" value="<? echo $download_list[0]['end_date']; ?>"/>
			</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_exporttype1" id="vis_exporttype1" class="form-control input-sm selectpicker">
                    <?
                                       for($i=1;$i<=count($export);$i++) {
										
                                       if($download_list[0]['export_type'] == $i) $selected='selected="selected"'; else $selected='';
                                       echo '<option value="'.$i.'" '.$selected.' >'.$export[$i].'</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();" <? if($download_list[0]['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" value="<? echo $download_list[0]['email_id']; ?>" />
			</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','start_hidden_date': $('#vis_hidden_schedule_start_date').val(),'end_hidden_date': $('#vis_hidden_schedule_end_date').val(),'export_type1': $('#vis_exporttype1').val(),'vis_static_area':'update_list','current_operation':'update','vis_rschedule_id':'<? echo $operation['vis_rschedule_id'];?>','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(),'staff_id':'<? echo $operation['staff_id'];?>','department_id':'<? echo $operation['department_id'];?>','client_id':'<? echo $operation['client_id'];?>','group_id':'<? echo $operation['group_id'];?>','domain_id':'<? echo $operation['domain_id'];?>','survey_id':'<? echo $operation['survey_id'];?>','vis_client_id':'<? echo $operation['vis_client_id'];?>','vis_criteria':'<? echo $operation['vis_criteria'];?>','report_type':'<? echo $download_list[0]['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 $download_list[0]['creation_date'];?>','report_filter':'<? echo $operation['report_filter'];?>'});"><? echo $vis_language['TXTUPDATE']; ?></a>
    </div>
  </div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
<script>
	toggle_email();
function toggle_email() {
	
	 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>
