<?php include('inc/header.php');
$clientObj->select($org_id);

if(isset($_POST['week_submit']))
{

if($status1!='' || $status2!='' || $status3!='' || $status4!='' || $status5!='' || $status6!='' || $status7!='')
{	
for($i=1;$i<8;$i++)
{
	$id=sanitize($_POST['id'.$i]);
	$status=sanitize($_POST['status'.$i]);
	if($status=='')
	{
		$status=-1;
	}
	if($status=='1')
	{
		$status=1;
	}
	
$weekdaysObj->select($id); 
$weekdaysObj->days=$weekdaysObj->days;
$weekdaysObj->status=$status;
$weekdaysObj->update($id);
}
$msg=1;
} 
else 
{ 
$daymissing=1; 
}

}



?>

<!-- mobile navigation -->
			<nav id="mobile_navigation"></nav>
			
			<section id="breadcrumbs">
				<div class="container">
					<ul>
						<li><a href="#">Web school </a></li>
                        <li><a href="#">Human Resource </a></li>
                        <li><a href="#">Working Days </a></li>
						<li><span> Set Weekdays</span></li>						
					</ul>
				</div>
			</section>
			<section class="container clearfix main_section">
				<div id="main_content_outer" class="clearfix">
					<div id="main_content">
						<div class="alert alert-info"><strong>Set Weekdays</strong></div>
                         <?php 
						if($setting_error==1)
						{
						?>
                        <div class="warning">Hello ! Please <a href="general_setting.php" />Click Here</a> Complete your settings page. It is very important to fill up your general settings before you start.</div>
                        <?php
						}?> 
						<?php 
						if($daymissing==1)
						{
						?>
                        <div class="error">You should mark atleast 2 working days.</div>
                        <?php
						}?>
                        <?php 
						if($msg==1)
						{
						?>
                        <div class="success">Weekdays has been added successfully</div>
                        <?php
						}?> 
                         
						<!-- main content -->
                        <?php  $weekdayslist=$weekdaysObj->selectall();
						if(count($weekdayslist)>0)
						{ ?>
        
                        <form action="#" method="POST" id="week_days" name="week_days" enctype="multipart/form-data">
						<div class="row">
							<div class="col-sm-12">
								<div class="panel panel-default">
									<!--<div class="panel-heading">
										<h4 class="panel-title">Simple Validation</h4>
									</div>-->
									<div class="panel-body"> 
                                                <div class="form_sep">
												<label class="req">Select Week Days </label>
                                                <?php $i=1; foreach($weekdayslist as $list) {?>
												<span class="sepV_b">
                                                <input type="checkbox" class="icheck" id="ichbox_1" name="status<?php echo $i; ?>" value="1" <?php if($list->status==1){ ?> checked="checked" <?php } ?> > 
                                                <input type="hidden" name="id<?php echo $i; ?>" id="id<?php echo $i; ?>" value="<?php echo $list->id;  ?>" />
                                                <input type="hidden" name="day<?php echo $i; ?>" id="day<?php echo $i; ?>" value="<?php echo $list->days;?>"  />	
                                                <label for="ichbox_1" class="icheck_label"><?php echo $list->days; ?></label>
                                                </span>
                                                <?php $i++; } ?>
												
											</div>
									</div>
								</div>
							</div>
						</div>
						<div class="row">
							<div class="col-sm-5">
							<div class="form_sep">
							<button class="btn btn-success" type="submit" name="week_submit" id="week_submit" >Save</button>
							</div>
                            </div>
                                
                            
						</div>
						</form>
                        
						<?php }
						?>	
						</div>
					</div>
				
			</section>
			<div id="footer_space"></div>
		</div>
	<?php include('inc/footer.php'); ?>