<? global $vis_language;
?> 
<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['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>
                      <? echo $vis_language['TXTSENDEMAIL']; ?>
                      </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" data-module="new_toemail"/>
			<script type="text/javascript">
					$(document).ready(function() {
						$("#vis_toemail").tokenInput(
							"index.php?vis_module=client&vis_operation=list_clients&vis_domain=<? echo $operation['domain_id'];?>",{
								theme: "facebook",
								searchDelay: 300,
								minChars: 3,
								queryParam: "vis_data",
								propertyToSearch: "email",
								tokenValue: "email",
								resultsFormatter: function(item){ return "<li>" + "<div style='display: inline-block;' class='m-xs'><div class='full_name'>" + item.full_name + " < " + item.email + " ></div></div></li>" },
								tokenFormatter: function(item) { return "<li><p>" + item.email + "</p></li>" }
							}
						);
						$("div.token-input-dropdown-facebook").css('width',$(".token-input-list-facebook").width()+2+'px');
					});
					//$("#vis_toemail").tokenInput("add", {id: '0', email: $("#token-input-vis_toemail").val()});
					</script>				
			</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_report','vis_form':'vis_<?= $operation['vis_operation'] ?>_frm','export_filename': $('#vis_filename').val(),'vis_static_area':'export','duration':'<? echo $operation['duration'];?>','from_date':'<? echo $operation['from_date'];?>','to_date':'<? echo $operation['to_date']; ?>','staff_id':'<? echo $operation['staff_id'];?>','flag_id':'<? echo $operation['flag_id'];?>','quest_id':'<? echo $operation['quest_id'];?>','maxcount':'<? echo $operation['maxcount'];?>','vis_new_ticket_list_client1':'<? echo $operation['vis_new_ticket_list_client1'];?>','department_id':'<? echo $operation['department_id'];?>','status_id':'<? echo $operation['vis_status_id']?>','vis_link_type':'<? echo $operation['vis_link_type']?>','client_id':'<? echo $operation['client_id'];?>','group_id':'<? echo $operation['group_id'];?>','domain_id':'<? echo $operation['domain_id'];?>','maxcount':'<? echo $operation['maxcount']?>','survey_id':'<? echo $operation['survey_id'];?>','vis_client_id':'<? echo $operation['vis_client_id'];?>','vis_new_ticket_list_client':'<? echo urlencode($operation['vis_new_ticket_list_client']);?>','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_usedby':'<?echo $operation['vis_usedby'];?>','vis_ci_type':'<?echo $operation['vis_ci_type'];?>','depr_type_id':'<?echo $operation['depr_type_id']; ?>','vis_impact_condition':'<? echo $operation['vis_impact_condition'];?>','vis_impact':'<? echo $operation['vis_impact']?>','vis_criteria':'<? echo $operation['vis_criteria'];?>','report_type':'<? echo $operation['report_type'];?>','vis_filter_id':'<? echo $operation['vis_filter_id'];?>','channel_id':'<? echo $operation['channel_id'];?>','field_type':'<? echo $operation['field_type'];?>','userfield_name':'<? echo $operation['userfield_name'];?>','location_id':'<? echo $operation['location_id'];?>','product_id':'<? echo $operation['product_id'];?>','vendor_id':'<? echo $operation['vendor_id'];?>','asset_id':'<? echo $operation['asset_id'];?>','vis_client_start':'<? echo $operation['start_char'];?>','export_type':$('#vis_exporttype').val(),'send_email':($('#vis_sendemail').is(':checked'))?$('#vis_sendemail').val():0,'email_id':$('#vis_toemail').val()});"><? 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();
}
</script>

