<!DOCTYPE html>
<html>
    <head>
<?php include("header-js.php");?>	
		
		
<!-----hrm india-------------->		
<?php /*?><link rel="stylesheet" href="css/style.css" />
<!-- Responsive -->
<link rel="stylesheet" href="css/responsive.css" /><?php */?>
<link rel="stylesheet" href="css/jquery-ui.css" />
<!-----hrm-------------->
        <link href="css/AdminLTE_activity.css" rel="stylesheet" type="text/css" />

    
    </head>
    <body class="skin-blue">
       <?php include("header.php");?>
	   <?php include("activity_header.php");?>
	   
				<!--grey_bg-->
				
				
	
				
				<div class="clearfix"></div>
				
				<div class="project_button_area">
				
				<div class="blue_header_activityplan">
				
				<div class="activityplan_header_div">
				<?php if($userid ==1){?>
								<div class="week_activityplan_text">	<font color="#FFFFFF" size="4px"><b>List Of Daily Report</b></font> </div>
					<?php }else{ ?>	
						<div class="week_activityplan_text">	<font color="#FFFFFF" size="4px"><b>Add Daily Report</b></font></div>	
					<?php } ?>	
				  </div><!--activityplan_header_div-->
								
								<div class="activityplan_select_week_div">
								
								
								
								<div class="week_activityplan_allign">

				

				

								
								
								
								</div><!--week_activityplan_allign-->
								
								
								<div class="week_activityplan_allign">
								
								
						
								
								
								</div><!--week_activityplan_allign-->
								
								
								
								<div class="week_activityplan_allign">
								
								
								

								
								

								
								
								
								</div><!--activityplan_select_week_div-->
								
								</div><!--week_activityplan_allign-->
								
								
								
				
				
				
				</div><!--blue_header_activityplan-->
								
				</div><!--project_button_area-->
				
		<form name="act_done" id="act_done" method="post">
		
				<?php if($userid !=1){?>
		
		<input type="hidden" name="userid" class="userid" value="<?=$userid?>"  />
				<input type="hidden" name="cur_dat" id="cur_dat" value="<?php echo date("d-m-Y");?>"  />
					<div class="add_project_div_activityplan">
					
				<?php  $projects_act_list_dat = mysql_fetch_array(mysql_query("SELECT * FROM project_plan_activity   where e_id='$userid' and week_no=1 and (flag1=0 || flag1=2)")); ?>
				<?php $num_val = mysql_fetch_array(mysql_query("SELECT * FROM project_plan_master "));?>
					<input type="hidden" name="resi_dats" id="resi_dats" value="<?php echo date("d-m-Y",strtotime($num_val['date_from']));?>" style="border:0px;"  class="resi_dat" />
		<input type="hidden" name="wek_end" id="wek_end" value="<?php echo date("d-m-Y",strtotime($num_val['date_to']));?>" style="border:0px;"  class="resi_dat" />
		
				<div class="project_free_div_activityplan">
								
								
																<div class="week_activityplan_allign">

				
				<div class="week_activityplan_text2">Week</div>
				
				<?php		$year           = date('Y');
$firstDayOfYear = mktime(0, 0, 0, 1, 1, $year);
$nextMonday     = strtotime('monday', $firstDayOfYear);
$nextSunday     = strtotime('sunday', $nextMonday);

?>
				
										<div class="week_activityplan">
								
								
								<select name="sel_wek" id="wek_usrs_ft"  >
  	<?php 
	
	$cnts=0;
while (date('Y', $nextMonday) == $year) {$cnts=$cnts+1;
    // date('d-m-Y', $nextMonday), '-', date('d-m-Y', $nextSunday).'<br />';
// $projects_current = $db->fetchQuery("SELECT * FROM project_plan_activity  where  ");
 
    $nextMonday = strtotime('+1 week', $nextMonday);
    $nextSunday = strtotime('+1 week', $nextSunday);
	?>
  <option value="<?php echo $cnts;?>" <?php if($cnts==$projects_act_list_dat['week_no']) {?>selected="selected" <?php } ?>><?php echo $cnts;?></option>
<?php } ?>

</select>
								
								
								</div><!--week_activityplan-->
								
								
								
								</div><!--week_activityplan_allign-->
								
								
								<div class="activityplan_select_week_div_bottom_closediv">
								
								<div class="activityplan_select_week_div_bottom">
								
												<div class="week_activityplan_text4_activitiesdone">From</div>
												
												<div class="form_div_2">
				
		
				<input type="text" name="date_frm" id="wek_from" value="<?php echo date("d-m-Y",strtotime($projects_act_list_dat['dates_from']));?>" readonly>

				</div>
												
												
								  </div>
												
												
								  </div>
												
												
																				<div class="activityplan_select_week_div_bottom_closediv">

												
												
																<div class="activityplan_select_week_div_bottom">
								
												<div class="week_activityplan_text3_activitiesdone">To</div>
												
												<div class="form_div_2">
				
<input type="text" name="date_tos" id="wek_to" value="<?php echo date("d-m-Y",strtotime($projects_act_list_dat['dates_to']));?>" readonly>

				</div>
												
												
												</div>
												
												
												</div>
												
												

												
																								
								
								
								
								
								</div>
								<?php } ?>
								
								<hr>
			<div id="new_div" >
					</div>
					
							<div class="button_position">
				<?php if($jcnt > 0){?>
													<div class="add_projects"><button type="button" class="add_projects" id="savclick" onClick="save_proj_done();" name="savclick">Submit</button></div>
						<?php } ?>						
				  </div>
				
				</div>
			

		</form>
	
				

				<section>
				<div class="project_id_activityplan_activitiesdone">
				
				
				<div class="clearfix"></div>
				
		
				

				<div id="m_divs">

				
				
			</div>
				
				
				</div>

				
				
				
				</section>
				
				<div class="clearfix"></div>
				
				

                </section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->


        <!-- jQuery 2.0.2 -->
		               <?php 
	include("footer-js.php");
?>
<input type="hidden" name="hid_sel" id="hid_sel" value="0">
<input type="hidden" name="hid_week" id="hid_week" value="<?php echo $weekNumber = date("W"); ?>">
<input type="hidden" name="countss" id="countss" value="0">
<input type="hidden" name="r_cnts" id="r_cnts" value="1">
<?php
$ddate = "2012-10-18";
$date = new DateTime($ddate);
$week = $date->format("W");
 "Weeknummer: $week";?>


    </body>
	



<link rel="stylesheet" href="css/jquery.ui.all.css">


<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="js/jqueryresigned-emp-ui.js"></script>
<!-- Jquery Package End -->
	<script src="js/activity.js" type="text/javascript"></script>
	
	
	<script type="text/javascript">
	function save_proj_done()
	{
	
		$count = $('.add-activity tr').length-1; 
		var alr=false; 
	

	var alr=false; 

	for(q=1;q<=$count;q++){


	 var prj=$('#proj_ids'+q).val(); 
	 var act=$('#act_vity'+q).val();
	 var hrs=$('#hurs'+q).val(); 
	 var task=$('#task_detail'+q).val();
	 var hrtask=$('#hurs_task'+q).val();
	 var d_dat=$('#daily_wrk_dat'+q).val();	
	 
	 
	      if(act!='' && hrs!='' && prj!='' && task!='' && hrtask!='' && d_dat!='')
		  {
		  var alr=true;
		  }
		  else
		  {
		     if(act=='')
			 {
		    document.getElementById("act_vity"+q).style.background="pink";
		     }
			  if(hrs=='')
			 {
		    document.getElementById("hurs"+q).style.background="pink";
			  }
			  
			  if(prj=='')
			 {
		    document.getElementById("proj_ids"+q).style.background="pink";
		     }
			  if(task=='')
			 {
		    document.getElementById("task_detail"+q).style.background="pink";
			  }
			  if(hrtask=='')
			 {
		    document.getElementById("hurs_task"+q).style.background="pink";
			  }	
			  if(d_dat=='')
			 {
		    document.getElementById("daily_wrk_dat"+q).style.background="pink";
			  }	 		  
			}
	}

	if(alr == false)
	{
	
	//|| p_name=='' || eid=='' || s_id==''alert();
	alert("Please Enter Atleast One Activity");
	}
	else
	{
		//$('#savclick').attr('disabled',true);
	dataString = $('#act_done').serialize();

$.post("project_done_add.php?action=grt_insert",dataString,function(data){
		var timing = data.timing; 
			window.document.location.reload();
	
		},'json');		
	 	

}		
		
	}
	</script>
	<style>
div.pagination {
padding: 3px;
margin: 3px;
text-align:center;
}

div.pagination a {
padding: 2px 5px 2px 5px;
margin: 2px;
border: 1px solid #AAAADD;

text-decoration: none; /* no underline */
color: #000099;
}
div.pagination a:hover, div.digg a:active {
border: 1px solid #000099;

color: #000;
}
div.pagination span.current {
padding: 2px 5px 2px 5px;
margin: 2px;
border: 1px solid #B0B7D1;

font-weight: bold;
background-color: #939399;
color: #FFF;
}
div.pagination span.disabled {
padding: 2px 5px 2px 5px;
margin: 2px;
border: 1px solid #EEE;

color: #DDD;
}

</style>
		<script type="text/javascript">
$(document).ready(function(){
changePagination('0');    
});
function changePagination(pageId){
var users='<?php echo $userid;?>';
     $(".flash").show();
     $(".flash").fadeIn(400).html
                ('Loading <img src="ajax-loader.gif" />');
     var dataString = 'pageId='+ pageId+'&userid='+users;
     $.ajax({
           type: "POST",
           url: "loadact_done_data.php",
           data: dataString,
           cache: false,
           success: function(result){
           $(".flash").hide();
                 $("#m_divs").html(result);
				  $('.example').tooltip();
           }
      });
}

	/*function clone_dv()
	{
	
	var incnt=$('#hid_sel').val();
	var cnt_hids=$('#cnt_hid').val(); 
	var counss=$('#countss').val();
	if(counss==0)
	{
	var ccnt=Number(cnt_hids)+1;
	$('#countss').val(ccnt);
	}
	else
	{

	var ccnt=Number(counss)+1;
	$('#countss').val(ccnt);
	}
	var qcccnt=Number(ccnt)-1;
	var incnt=Number(incnt)+1;
	
	$('#hid_sel').val(incnt);
	
	 var container = $('.add_project_div_activityplan');
     var clone = $('.clone_act_dv:last').clone();
     clone.attr('id','div_'+$('.clone_act_dv').length);
	 

	 if(counss==0)
	{
	 clone.find('#activities'+cnt_hids).attr('id','activities'+ccnt);
	 clone.find('#hurs'+cnt_hids).attr('id','hurs'+ccnt);
	 
	 clone.find('#activities'+cnt_hids).css("background-color","");
	 clone.find('#hurs'+cnt_hids).css("background-color","");
	 
	  }
	  else
	  {
	  clone.find('#activities'+qcccnt).attr('id','activities'+ccnt);
	  clone.find('#hurs'+qcccnt).attr('id','hurs'+ccnt);
	  clone.find('#activities'+qcccnt).css("background-color","");
	  clone.find('#hurs'+qcccnt).css("background-color","");
	  }
	  if(Number(incnt)==1)
{
     clone.find('.stg_ss option:selected').remove();

	 clone.find('#stg_div').attr('id','stg_div'+incnt);
	  clone.find('#projstage_id').val('');
}
else
{
var dcnt=Number(incnt)-1;
clone.find('#stg_div'+dcnt).attr('id','stg_div'+incnt);

}	 
	 clone.find('input').val('');
    container.find('.button_position').before(clone);
	var dataString = 'pageId='+ incnt;
	        $.ajax({
           type: "POST",
           url: "loadact_project.php",
           data: dataString,
           cache: false,
           success: function(result){
           $(".flash").hide();
               clone.find("#sel_div").html(result);
           }
      });
	  

	  


	}*/
	
//$count = $('#add-activity tr').length;
	function clone_dv()
	{
	
 //$(".list-leaves").clone().append(".m_tr");
	   var c = 0;
	   var d = 0;
	   var rcounts=$('#r_cnts').val();
	   var rrccnt=Number(rcounts)+1;
	   $('#r_cnts').val(rrccnt);
	   var f_rcnt=$('#r_cnts').val();
	   
	   $count = $('.add-activity tr').length; 

	/*  cloned = $( '#m_tr'+c);
     // $('.m_tr').clone().insertAfter( cloned );
	   $("#m_tr"+c).clone().attr('id', 'id'+(++c) ).insertBefore( cloned );
	  cloned.find('#slnoo'+d).attr('id','slnoo'+f_rcnt);
      cloned.find('#slnoo'+f_rcnt).text(f_rcnt);*/
	

		$clone = $('.m_tr:first').clone(true);
		$clone.find('input').val('');
		$clone.find('select').val('');
		/*$clone.find('.projname_clss').attr('id','proj_name'+$count);
		$clone.find('.projname_clss').attr('data-id',$count);*/
		
		$clone.find('.dj').attr('id','daily_wrk_dat'+$count);
		$clone.find('.task_read').attr('id','task_detail'+$count);
		$clone.find('.hrs').attr('id','hurs'+$count);
		$clone.find('.hrs').attr('disabled',false);
		$clone.find('.actss').attr('id','act_vity'+$count);
		$clone.find('.hrss').attr('id','hurs_task'+$count);
		
		
		$clone.find('td.activity-slno').text($count);
		$parent = $('.add-activity');
		$parent.append($clone);
	
		
		$clone.find('.task_read').attr('readonly', false);
		
			var dataString = 'pageId='+ $count;
	        $.ajax({
           type: "POST",
           url: "loadact_project.php",
           data: dataString,
           cache: false,
           success: function(result){
           $(".flash").hide();
               $clone.find('.sel_div').html(result);
           }
      });

	  //projectId
	  	        $.ajax({
           type: "POST",
           url: "loadact_project_id.php",
           data: dataString,
           cache: false,
           success: function(result){
           $(".flash").hide();
               $clone.find('.sel_p_id').html(result);
           }
      });
	  
	  	$count++;
	  
	}
	
	
	function goto_div_val(wek){ 
    var u_id='<?php echo $userid;?>'
     var dataString = 'pageId='+ wek+'&user='+u_id; 
     $.ajax({
           type: "POST",
           url: "loadact_data_weeks.php",
           data: dataString,
           cache: false,
           success: function(result){
           $(".flash").hide();
		   $('.clone_act_dv').remove();
		   $('.button_position').remove();
		   
                 $("#new_div").html(result);
				 newDateString_from= $('#wek_to').val();
    			 newDateStringTo_from=$('#wek_from').val(); 
				 go_to_cal(newDateString_from,newDateStringTo_from);
				 
				
           }
      });
}

function get_proj(obj,id)
{
   // or $(this).val()
  
  $('#proj_ids'+id).val(obj.value);
  $('#proj_name'+id).val(obj.value);
/*   var p_id=obj.value;
         var dataString = 'pj_id='+ p_id+'&pageId='+id;
     $.ajax({
           type: "POST",
           url: "loadact_projectstage.php",
           data: dataString,
           cache: false,
           success: function(result){
           $(".flash").hide();
                 $("#stg_div"+id).html(result);
           }
      });*/
}

/*$('.resi_dat').live('click',function(){ 
		 $(this).datepicker({dateFormat:"YYYY-MM-DD"}).focus();	//alert();
		     dateformat: 'yy-mm-dd'
	});*/
var min_dat=$('#wek_from').val();
var max_dat=$('#cur_dat').val();

/*$('#daily').datepicker({ 

dateFormat:"dd-mm-yy" ,
'minDate':''+min_dat+'',
'maxDate':''+max_dat+''
});*/
/*$('#daily').data('daterangepicker').setStartDate('2014-03-01');
$('#daily').data('daterangepicker').setEndDate('2014-09-24');
});*/
var wek_val=$('#hid_week').val();
/*$('#wek_usrs_ft').val(wek_val);*/
change_week(wek_val);


function go_to_cal(to_dat,from_dat)
{
     var dataString = 'too='+ to_dat+'&frmm='+from_dat; 
     $.ajax({
           type: "POST",
           url: "loadact_daily_dat.php",
           data: dataString,
           cache: false,
           success: function(result){
           $(".flash").hide();
                 $(".datesdiv").html(result);
           }
      });
}

function sort_act_list(obj)
{

var wekss=obj.value;
var pageId=0;
   var users='<?php echo $userid;?>';
     var dataString = 'pageId='+ pageId+'&userid='+users+'&weks='+wekss;
     $.ajax({
           type: "POST",
           url: "loadact_done_data.php",
           data: dataString,
           cache: false,
           success: function(result){
           $(".flash").hide();
                 $("#m_divs").html(result);
				  $('.example').tooltip();
           }
      });
	  


}
</script>
	
</html>