<?php $this->load->view("main/drs/header"); ?>
<?php
$dayname = array("یکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنجشنبه","جمعه","شنبه")
?>
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/datepicker/bootstrap-datepicker.min.css" />
    <section class="panel">
		<style>
			.folder{
	   float: right;
	   margin-left:15px;
	   cursor: pointer;
	   border-radius: 5px;
	   margin-bottom:10px;
	   position: relative;
	   margin-top:10px;
}
.folder i:hover{
	   border: 1px solid rgb(112,146,190) !important;
	   color: rgb(112,146,190) !important;
}
.add:hover,.back:hover{
	 border: 1px solid green;
	   color: green !important;   
}
.folder i {
	   font-size: 55px;
	   display: block;
	   text-align: center;
	   margin-right:5px;
	    border: 1px solid #ddd;
		width: 90px;
		height: 90px;
		line-height: 90px;
		color: #000;
		border-radius: 10px;
		
}.folder span{
	   width: 85%;
	   display: block;
	   text-align: center;
	   font-size: 12px;
	   margin-top:15px;
	   margin-right:10%;
	   text-align: center;
	   font-size: 10px;
}
.col-lg-12{
	float: right;
	margin-bottom:30px;
}
.col-lg-12 input{
	float: right;
	height: 88px;
	padding: 10px;
	border-radius: 10px;
	border: 1px solid #ccc;
	margin-top:11px;
	
}
h4
{
color: rgb(56,171,181);
}
.green{
	color:#a9d96c !important;
	border:1px solid #a9d96c !important;
}
.red{
	color:#f00 !important;
	border:1px solid #f00 !important;
}
.green:hover{
	color:#a9d96c !important;
	border:1px solid #a9d96c !important;
}
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default{
		border: 1px solid #ccc !important;
		border-radius: 7px  !important;
	}
	.ui-state-default:hover, .ui-widget-content .ui-state-default:hover, .ui-widget-header .ui-state-default:hover{
		background:#08c !important;
		color: #fff;
	}
	.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active{
		background:#08c !important;
		
	}
	.form-control{
		margin-bottom:10px;
	}
	.btn
	{
		float: left;
	}
	.item{
		width: 17%;
		padding: 0 1%;
		height: 30px;
		background: rgb(105,131,164);
	}
	.item-holder{
		float:left;
		margin-top:10px;
		
	}
	.item-holder .item{
		border-radius: 10px;
		color: #fff;
		line-height: 30px;
		float: right;
		margin-left:10px;
		margin-bottom:10px;
	}
	.item-holder .item i{
		float: left;
		font-size: 17px;
		line-height: 30px;
		color: rgb(255,160,164);
	}
	.item-holder .item i:hover{
		cursor: pointer;
	}
	.add_dr{
		font-size: 29px;
	line-height: 35px;
	}
		</style>
	<header class="panel-heading">نوبت دهی</header>
		<div class="panel-body">
			<form action="<?php echo base_url(); ?>panel/control_setting" method="post">
			<div class="col-lg-12">
				<div class="folder pass" data_type="folder"><i class="icon-unlock-alt"></i><span>تغییر کلمه ی عبور</span></div>
			<div class="folder date"><i class="icon-calendar"></i><span>تاریخ</span></div>
			<div class="folder time"><i class="icon-time"></i><span>ساعت</span></div>
			<div class="folder docnum"><i class="icon-sort-by-order"></i><span>شماره پرونده</span></div>
			
			</div>
			<div class="panel_display user_name" style="display:none;">
				<input type="text" name="old_pass" class="form-control" placeholder="رمزعبور فعلی">
				<input type="text" name="new_pass" class="form-control" placeholder="رمز عبور جدید">
				<input type="text" name="new_pass_rep" class="form-control" placeholder="تکرار رمز عبور">
			</div>
			<div class="panel_display day" style="display:none;">
				<div class="col-lg-12">
				
											<div class="col-lg-11">
                                                <select type="text" class="form-control drs" style="padding:0px;">
												<option value="6">شنبه</option>
												<option value="0">یکشنبه</option>
												<option value="1">دوشنبه</option>
												<option value="2">سه شنبه</option>
												<option value="3">چهار شنبه</option>
											   <option value="4">پنج شنبه</option>
												<option value="5">جمعه</option>
											</select>
											</div>
													<div class="col-lg-1">
												<span class="add_dr"><i class="icon-plus-sign-alt"></i></span>
												</div>
												<input type="hidden" class="drs_add" name="day_add" value="<?php echo @$info[0]->day_work; ?>">
												<div class="col-lg-12 item-holder">
													<?php @$days = explode(",", $info[0]->day_work); ?>
													<?php foreach($days as $value){ ?>
													<?php if($value != ""){ ?>
													<div class="item" data_id="<?php echo $value; ?>"><span><?php echo @$dayname[$value]; ?></span><i class="icon-remove-circle"></i></div>
													<?php } ?>
													<?php } ?>
												</div>
		</div>
			</div>
			<div class="panel_display timep" style="display:none;">
				<input type="text" name="start_time" class="form-control" value="<?php echo @$info[0]->time_work_s; ?>" placeholder="ساعت شروع">
				<input type="text" name="end_time" class="form-control" value="<?php echo @$info[0]->time_work_e; ?>" placeholder="ساعت پایان">
				<input type="text" name="visitavg_time" class="form-control" value="<?php echo @$info[0]->time_visit_avg; ?>" placeholder="میانگین زمانی ویزیت هر نفر">
				</div>
			<div class="panel_display document_number" style="display:none;">
				<input type="text" name="doc_number" class="form-control" value="<?php echo @$info[0]->doc_number_s; ?>" placeholder="شروع شماره پرونده">
			</div>
			<div class="col-lg-12">
			<button class="btn btn-info">ثبت</button>
			</div>
			</form>
	</section>
		
<?php $this->load->view("main/drs/footer"); ?>
<script>
		$(".add_dr").click(function(){
		$value = $(".drs option[value='"+$(".drs").val()+"']").text();
		$valueimp = $(".drs").val();
		$lastvalue = $(".drs_add").val();
		$run = true;
		$(".item").each(function(){
			if ($(this).attr("data_id") == $valueimp) {
				$run = false;
			}
			
			})
		if ($run) {
			$(".drs_add").val($valueimp + "," + $lastvalue);
		$html = '<div class="item" data_id="'+ $valueimp +'"><span>'+ $value +'</span><i class="icon-remove-circle"></i></div>';
		$(".item-holder").append($html);
		}
		});
		$('body').on('click', '.item .icon-remove-circle', function() {
		$index = $(this).parent().attr("data_id");
		$value = $(".drs_add").val();
		$valuepush = $value.split(",");
		$value = "";
		for($i=0;$i<$valuepush.length;$i++){
			if ($valuepush[$i] != $index && $valuepush[$i] != "") {
				$value += $valuepush[$i] + ","
			}
		}
		$(".drs_add").val($value);
		$(this).parent().remove();
		});
		$(".pass").click(function(){
			$(".panel_display").css({"display":"none"});
			$(".user_name").css({"display":"block"});
			$(".folder i").removeClass("green");
			$(this).find("i").addClass("green");
			});
		$(".date").click(function(){
			$(".panel_display").css({"display":"none"});
			$(".day").css({"display":"block"});
			$(".folder i").removeClass("green");
			$(this).find("i").addClass("green");
			});
		$(".time").click(function(){
			$(".panel_display").css({"display":"none"});
			$(".timep").css({"display":"block"});
			$(".folder i").removeClass("green");
			$(this).find("i").addClass("green");
			});
		$(".docnum").click(function(){
			$(".panel_display").css({"display":"none"});
			$(".document_number").css({"display":"block"});
			$(".folder i").removeClass("green");
			$(this).find("i").addClass("green");
			});
</script>
