<div class="hide_search_div">
<button type="button" id="add_document_template" class="btn btn-primary" style="margin:0 0 5px 10px;">Add Document Template</button>
	<div class="panel box box-primary <?=$collapse_add_area;?>" id="document_template_area">
		<div class="box-header with-border">
			<form action="" method="post" name="add_document_template_form" id="add_document_template_form">
				<div class="col-sm-12">
					<label for="Document Template" class="control-label">Document Template</label>
					<? $gsi->getDocumentTemplateList("document_template_id",$document_template_id,"100%",false,"form-control select2"); ?>
				</div>
				<div class="col-sm-12">	
					<div id="section_div"></div>
				</div>
				<div style="clear:both;margin-top:23px;"></div>
				<div class="col-sm-12">
					<input type="hidden" id="id" name="id" value="<?php echo $id;?>">
					<input type="hidden" id="job_id" name="job_id" value="<?php echo $job_id;?>">
					<input type="hidden" id="page_action" name="page_action" value="<?php echo $page_action;?>">
					<button type="submit" name="add_master_data" id="submit_form"  class="btn btn-primary"><?=$button_value?></button>
					<i class="fa fa-refresh fa-spin" style="display:none;" id="page_load_div_for_document_template"></i>
					<i class="fa fa-check" id="document_template_done" style="color:#bad23a;font-size: 20px;display:none;"></i>
				</div>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript">
$(function(){
	$("#document_template_id").change(function(){	
		var document_template_id = $(this).val();
		if(document_template_id != ""){
		var form_data   = {'document_template_id':document_template_id};       
			$.ajax({
				async: false,
				type: "POST",
				url: site_url+"/modules/template_document/index.php?page=ajax_actions&action=get_template_section_by_template_id",
				data: form_data,
				success: function(result){  
					if(result){
						$("#section_div").html(result);
						$(".checkbox_div").iCheck({
							checkboxClass: 'icheckbox_flat-blue'
						});
					}else{
						$("#section_div").html(result);
					}
				}
			});
		}
	});
});
</script>