<? 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$vis_language['TXTLINKSOLUTION']; ?></h4>
        </div>
        <div id="parent_list" class="modal-body">
            <div class="row">
                <div class="col-sm-12">
                <section id="test" class="scrollable wrapper">
                <div class="row m-b">
                <div class="col-md-12">
                <form method="post" role="form" class="form-horizontal" name="vis_linkproblem_<?= $operation['vis_problem_id'];?>" id="vis_linkproblem_<?= $operation['vis_problem_id'];?>">
				<div class="form-group">
                   <div class="col-sm-12">
					<input type="text" id="search_language_variables" onkeyup="vis_apply_filter(this.value);" placeholder="<?php echo $vis_language['TXTSERACHPROBLEMSOLUTION'];?>" class="form-control">
                   </div>
				   <div class="col-sm-3"></div>
                </div>
                <div class="form-group" id="vis_show_amt_balance">
                    <div class="col-sm-12">
                        <div id="configuration_item"></div>
                    </div>
                </div>
				<input type="hidden" name="vis_problem_id" id="vis_problem_id" value="<?= $operation['vis_problem_id'];?>">
                <input type="hidden" name="vis_solution_type" id="vis_solution_type" value="<?= $operation['vis_solution_type'];?>">
              </form>
              </div>
              </div>
              </section>

              </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="$(this).visExecution('submit_form',{'vis_module':'problem', 'vis_operation':'link_problem_solution', 'vis_form':'vis_linkproblem_<?= $operation['vis_problem_id'];?>'});"><? echo $vis_language['TXTLINK']; ?></a>
        </div>
    </div>
</div>
<script type="text/javascript">
	$('.selectpicker').selectpicker();

	function vis_apply_filter(filter){
		var data = {'vis_problem_id':'<?= $operation['vis_problem_id'];?>', 'vis_filter':''+filter+'', 'vis_solution_type':'<?= $operation['vis_solution_type'];?>'};

		if(filter==''){
			$("#configuration_item").html('<div style="text-align:center;"></div>');
		}
		if(filter!=''){
		  var len = filter.length;
		  if(len>2){
			$.ajax({
				url: 'index.php?vis_module=problem&vis_operation=get_problem_solution',
				data: data,
				type: "POST",
				dataType: "json",
				success: function(data){
					$("#configuration_item").html(data.list);
				},
				error: function(xhr, ajaxOptions, thrownError) {$("#vis_global_msg_div").visInterface("load_global_message", "Error: "+xhr.status+" - "+thrownError);}
			});
			}else{
			  $("#configuration_item").html('<div style="text-align:center;"><?= $vis_language['TXTGLOBALSEARCHERROR'];?></div>');
		    }
		}else{
			$("#configuration_item").html('<div style="text-align:center;"><?= $vis_language['TXTNOMATCHFOUND'];?></div>');
		}

	}
</script>
