<?php $this->load->view("main/drs/header"); ?>
<?php
 if($this->session->userdata("per") == 1){
  $value_of_text = "مشتری";
   $bimeh_value = "تخفیف";
 }else{
  $value_of_text = "بیمار";
  $bimeh_value = "بیمه";
 }
?>
<style>
	.col-lg-12, .col-lg-6{
		float: right;
	}
</style>
<div class="col-lg-12">
<section class="panel">
        <header class="panel-heading">ثبت <?php echo $bimeh_value; ?></header>
                            <div class="panel-body">
								<form action="./set_insure_control" method="post">
									<input type="hidden" value="<?php echo count($bimeh)+1; ?>" class="number" name="number">
									<?php $count=1; foreach($bimeh as $value){ ?>
									<div class="col-lg-6">
								<div class="form-group">
									

                                                        <label for="exampleInputEmail1">نام <?php echo $bimeh_value; ?></label>

                                                        <input type="text" name="insurename<?php echo $count; ?>" class="form-control" value="<?php echo $value->name; ?>" id="exampleInputEmail3">
                                                    </div>
								</div>
								<div class="col-lg-6">
								<div class="form-group">
                                                        <label for="exampleInputEmail1">درصد <?php echo $bimeh_value; ?></label>
                                                        <input type="text" name="insurepercent<?php echo $count; ?>" class="form-control" value="<?php echo $value->percent; ?>" id="exampleInputEmail3">
                                                    </div>
								</div>
									<?php $count++; } ?>
								<div class="col-lg-6">
								<div class="form-group">
									
									
                                                        <label for="exampleInputEmail1">نام <?php echo $bimeh_value; ?></label>
                                                        <input type="text" name="insurename<?php echo count($bimeh)+1; ?>" class="form-control" id="exampleInputEmail3">
                                                    </div>
								</div>
								<div class="col-lg-6">
								<div class="form-group">
                                                        <label for="exampleInputEmail1">درصد <?php echo $bimeh_value; ?></label>
                                                        <input type="text" name="insurepercent<?php echo count($bimeh)+1; ?>" class="form-control" id="exampleInputEmail3">
                                                    </div>
								</div>
								<div class="col-lg-12 content">
									<button class="btn btn-defult">بیشتر</button>
									<input type="submit" class="btn btn-info" value="ذخیره">
								</div>
								</form>
							</div>
</section>
</div>
<?php $this->load->view("main/drs/footer"); ?>
<script>
	$(".btn-defult").click(function(){
		$number = Number($(".number").val())+1;
		$html= '<div class="col-lg-6">';
		$html +='<div class="form-group">';
        $html += '<label for="exampleInputEmail1">نام <?php echo $bimeh_value; ?></label>';
        $html +=  '<input type="text" name="insurename'+$number+'" class="form-control" id="exampleInputEmail3">';
        $html +=   '</div>';
		$html +=	'</div>';
		$html +=	'<div class="col-lg-6">';
		$html +=	'<div class="form-group">';
        $html +=     '<label for="exampleInputEmail1">درصد <?php echo $bimeh_value; ?></label>';
        $html +=     '<input type="text" name="insurepercent'+$number+'" class="form-control" id="exampleInputEmail3">';
        $html +=     '</div></div>';
		$(".content").before($html);
		$(".number").val($number);
		return false;
		});
</script>