<script type="text/javascript">
$(document).ready(function() {
    $('#selecctall').click(function(event) {  //on click
        if(this.checked) { // check select status
            $('.checkbox1').each(function() { //loop through each checkbox
                this.checked = true;  //select all checkboxes with class "checkbox1"              
            });
        }else{
            $('.checkbox1').each(function() { //loop through each checkbox
                this.checked = false; //deselect all checkboxes with class "checkbox1"                      
            });        
        }
    });
   
});

</script>

<script>
$(document).ready(function(){
	$('select').select2();
});
</script>
<div id="content">                        
<div class="wrap">
                  
<div class="head">
	<div class="info">
		<h1><?php echo element('compName', $this->session->userdata('logged_in')) ?> [ 
		<?php echo element('compNo', $this->session->userdata('logged_in')) ?> ]</h1>
			<ul class="breadcrumb">
            	<li><a href="<?php echo base_url()?>home"><?php echo $this->lang->line('dashboard') ?></a> <span class="divider">-</span></li>
                <li><a href="zakat/home"><?php echo $this->lang->line('module') ?></a> <span class="divider">-</span></li>
                <li class="active"><?php echo $this->lang->line('title') ?></li>
            </ul>
	</div>
                          
	<div class="search">
		<form action="<?php echo base_url() ?>admin/search" method="post">
			<input name="search_text" type="text" placeholder="search..."/>                                
            <button type="submit"><span class="i-magnifier"></span></button>
		</form>
	</div>                        
</div>  <!-- Head -->
<div class="content">
	<div class="row-fluid">
		<div class="span12">
			<?php 
				$hidden = array('order_time' => date('Y-m-d H-i-s'));
				$attrib = array('id'=>'validate'); 
				echo form_open('', $attrib, $hidden);?>
            <div class="block">
               	<div class="head">
                   	<h2><?php echo $this->lang->line('title') ?></h2>
                    <div class="side fr">
                       <button class="btn" onClick="clear_form('#validate');" type="button">Clear form</button>
                    </div>
				</div>
				<div class="content np">    
                  <div class="controls-row">
                  	<div class="span2"><?php echo $this->lang->line('waqif') ?></div>
                   	<div class="span10">
						<?php
							echo"<select id='waqif' name='waqif' style='width:250px'>
								<option>--Please Select--</option>
            					<option value='founder'>Founder(s)</option>
            					<option value='owner'>Owner(s)/Shareholder(s)</option>
            					<option value='director'>Director(s)</option>
            					<option value='other'>Other(s)</option>     
        					</select>";
						?>                       
                  	</div>                            
                  </div>
                  <div class="controls-row"> <!-- row 1 -->
                    	<div class="span2"><?php echo $this->lang->line('allocation') ?></div>
                   		<div class="span4">
						<?php echo "<input type='checkbox' name='lumpSum' value='1'> Lump Sum<br>";?>       
                     </div>                
                    	<div class="span1" TAR><?php echo $this->lang->line('amount') ?></div>
                   		<div class="span4">
						<?php 								
								$data = array(
									'name'=>'amountLumpSum',
									'id'=>'amountLumpSum',								
									'class'=>'span8',); 
									echo form_input($data, set_value('amountLumpSum')); ?>      
                     </div>                
                  </div><!-- End Row 1 -->
                  <div class="controls-row"> <!-- row 1 -->
                   	<div class="span2"></div>
                   		<div class="span4">
						<?php
							echo"<input type='checkbox' name='percentage' value='2'> Percentage";
							
						?>       
                         </div>                
                  </div><!-- End Row 1 -->
                  <div class="controls-row"> <!-- row 2 -->
                    	<div class="span2"></div>              
                    	<div class="span2" TAR><?php echo $this->lang->line('sales') ?></div>
                   		<div class="span4">
						<?php 								
								$data = array(
									'name'=>'contributionPercentageLumpSum',
									'id'=>'contributionPercentageLumpSum',								
									'class'=>'span8',); 
									echo form_input($data, set_value('contributionPercentageLumpSum'));
									echo "%"; ?>      
                     </div>                
                  </div><!-- End Row 2 -->
                  <div class="controls-row"> <!-- row 3 -->
                    	<div class="span2"></div>              
                    	<div class="span2" TAR><?php echo $this->lang->line('amount') ?></div>
                   		<div class="span4">
						<?php 								
								$data = array(
									'name'=>'amountLumpSum',
									'id'=>'amountLumpSum',								
									'class'=>'span8',); 
									echo form_input($data, set_value('amountLumpSum'));
									echo "%"; ?>      
                     </div>                
                  </div><!-- End Row 3 -->
                  <div class="controls-row"> <!-- row 4 -->
                    	<div class="span2"><?php echo $this->lang->line('category') ?></div>
                   		<div class="span4">
						<?php 								
							echo"<input type='radio' id='general' name='category' value='general'> General";?>     
                     </div>                
                  </div><!-- End Row 4 -->
                  <div class="controls-row"> <!-- row 5 -->
                    	<div class="span2"></div>
                   		<div class="span4">
						<?php 								
							echo"<input type='radio' id='specific' name='category' value='specific'> Specific";?>     
                     </div>                
                  </div><!-- End Row 5 -->
                  <div class="table-sorting">
            	<table cellpadding="0" cellspacing="0" width="100%" id="test" class="editable">
                	<thead>
                    <tr>
            			<th style="display:none"></th>
            			<th class="tac">#</th>
                        <th><?php echo $this->lang->line('benificiaries');?></th>
                        <th><?php echo $this->lang->line('percentage');?></th>
                        <th><?php echo $this->lang->line('description');?></th>
            		</tr>
        			</thead>
       				 <tbody>
			<?php $bil = 0;
			//echo var_dump($datatbls); 
				if($datatbls){
				foreach($datatbls as $datatbl):
				$bil++?>
            	<tr>
                	<td style="display:none" ><?php echo $datatbl->ID; ?></td>
                	<td class="tac"><?php echo $bil; ?></td>
                    <td><?php echo $datatbl->name ?></td>
                    <td><?php 
						$data = array(
							'name'=>'contribution['.$datatbl->ID.']',
							'id'=>'contribution['.$datatbl->ID.']',								
							'class'=>'span3',); 
							echo form_input($data, set_value($datatbl->contributionPercentageDistribution));
							echo "%"; ?>
                    </td>
                    <td><?php 
						if (($datatbl->ID) == 6){  //others
						$data = array(
							'name'=>'descriptionDistribution',
							'id'=>'descriptionDistribution',								
							'class'=>'span10',); 
							echo form_input($data, set_value($datatbl->description));} ?>
                    </td>
                </tr>
            <?php endforeach; }?>
					</tbody>
                    <tr>
                	<td class="tac"><?php echo $bil + 1; ?></td>
                    <td><?php echo "Total"; ?></td>
                    <td><?php 
						$data = array(
							'name'=>'sequence',
							'id'=>'sequence',								
							'class'=>'span3',);
							$js='disabled=disabled'; 
							echo form_input($data, set_value('sequence'), $js);
							echo "%"; ?></td>
                    <td></td>
                </tr>
			</table>                                         
			</div>
            	  <div class="footer">
            		<div class="side fr">
                		<div class="btn-group">
                        <?php 
							$data = array(
									'name'=>'validat', 
									'class'=>'btn',
									'onClick'=>"$('#validate').validationEngine('hide');"); 
							echo form_button($data,'Hide prompts');
							$data = array(
									'name'=>'mysubmit', 
									'class'=>'btn btn-primary');
							$js='onclick="return confirm(\''.$this->lang->line('message3').'\')"';
							echo form_submit($data,'Submit',$js);
							?>
                    	</div>
                		</div>
            		</div>                                    
				</div>  <!-- content -->
    </form>
		</div>  <!-- block -->
		</div>  <!-- span12 -->
	</div>  <!-- row-fluid -->
</div>  <!-- content -->
</div>  <!-- wrap -->
</div>  <!-- content -->
