<div class="page-content" >
    
    
<div class="row">
    <div class="col-sm-12">
        <div class="widget-box">
            <div class="widget-header" style="height:70px;">
                <h4  style="text-align:center; color:green;"><b>Expense By Employee/Officers</b> </h4>
            </div>

            <div class="widget-body">
            
                 <?php
                                $message = $this->session->userdata('message');
                                if (!empty($message)) {
                                    ?>
                                    <div class="alert alert-block alert-success">
                                        <h6 class="lighter arial green" style="text-align:center;"><b>
                                                <?php echo $message;
                                                $this->session->unset_userdata('message');
                                                ?>
                                            </b></h6>
                                    </div>  
                                    <?php
                                }
                                $errormessage = $this->session->userdata('errormessage');
                                if (!empty($errormessage)) {
                                    ?>
                                    <div class="alert alert-block alert-danger">
                                        <h6 class="lighter arial red" style="text-align:center;"><b>
                                                <?php echo $errormessage;
                                                $this->session->unset_userdata('errormessage');
                                                ?>
                                            </b></h6>
                                    </div> 
                                    <?php
                                }
                                ?>
                <div class="widget-main no-padding"> 
                    <form action="<?php echo admin_url()?>/salaryexpensesetup/insert_salaryExpense " method="post">
                       
                        <fieldset class="col-xs-12 col-sm-12">
                            <div class="col-xs-2 col-sm-2"><label>Employee Id</label></div> 
                            <?php echo form_error('data[employee_id]', '<div style="color: rgb(255, 0, 0);">', '</div>'); ?>
                             <div class="col-xs-6 col-sm-6">
                             <select name="data[employee_id]" class="chosen-select" id="form-field-select-3" data-placeholder="Choose a State...">
                                 <option value=""> Select Employee Id......  </option>
                                 <?php if(!empty($allEmployeeId)){
                                        foreach($allEmployeeId as $value){
                                    ?>
                                    <option value="<?php echo $value['userId'];?>" <?php echo set_select('data[employee_id]',$value['userId'],FALSE);?>>
                                        <?php 
                                            echo $value['userId']; $emp_usrname=getEmployeeById($value['userId']); echo " (".$emp_usrname['userName']." ) ";
                                           
                                        ?>
                                    </option>
                                    <?php }
                                        }
                                    ?>
                            </select>
                            </div>
                         </fieldset>

                        <fieldset class="col-xs-12 col-sm-12">
                            <div class="col-xs-2 col-sm-2"><label>Type</label></div>
                            <?php echo form_error('data[salary_type]', '<div style="color: rgb(255, 0, 0);">', '</div>'); ?>
                             <div class="col-xs-6 col-sm-6">
                             <select name="data[salary_type]" class="chosen-select" id="mySelect" onchange="myFunction()">
                                    <option value=""> Select Selary Type......  </option>
                                    <option value="1">Hounariom</option>
                                    <option value="2">Salary</option>
                                    <option value="3">Commision</option>
                                    <option value="4">Incentive</option>
                                    <option value="5">2% Commission</option>
                            </select>
                            </div>
                         </fieldset>
                         
                        <!-- <fieldset class="col-xs-12 col-sm-12">-->
                        <!--    <label class="col-xs-2 col-sm-2">Type </label>-->
                        <!--    <?php// echo form_error('data[salary_type]', '<div style="color: rgb(255, 0, 0);">', '</div>'); ?>-->
                        <!--    <div class="col-xs-6 col-sm-6">-->
                        <!--    <select name="data[salary_type]" class="chosen-select" id="mySelect" onchange="myFunction()" >-->

                        <!--            <?php// foreach (getsalaryType() as $key => $value) { ?>-->
                        <!--                <option value="<?php// echo $key ?>" <?php// echo set_select('data[salary_type]', $key, FALSE); ?>>-->
                        <!--                    <?php// echo $value; ?>-->
                        <!--                </option>-->
                        <!--            <?php// } ?>-->
                        <!--        </select>-->
                        <!--   </div>-->
                        <!--</fieldset>-->
                        
                        
                        <fieldset class="col-xs-12 col-sm-12" id="customerSelect" style="visibility:hidden;">
                            <div class="col-xs-2 col-sm-2"><label>Customer id</label></div>
                            <?php echo form_error('data[customerId]', '<div style="color: rgb(255, 0, 0);">', '</div>'); ?>
                             <div class="col-xs-6 col-sm-6">
                             <select name="data[customerId]"  class="chosen-select" id="form-field-select-3" data-placeholder="Choose a State...">
                                 <option value=""> Select Customer Id......  </option>
                                 <?php if(!empty($allCustomers)){
                                        foreach($allCustomers as $value){
                                    ?>
                                    <option value="<?php echo $value['customerId'];?>" <?php echo set_select('data[customerId]',$value['customerId'],FALSE);?>>
                                        <?php 
                                        echo "".$value['customerId']." , ".$value['applicant_name']." , C: ".$value['com_emp']." , I: ".$value['incentive']."";
                                        ?>
                                    </option>
                                    <?php }
                                        }
                                    ?>
                            </select>
                            </div>
                         </fieldset>
                         
                         <fieldset class="col-xs-12 col-sm-12" >
                            
                        <p id="demo"></p>
                            
                        </fieldset>
                         
                        <fieldset class="col-xs-12 col-sm-12">
                            <label class="col-xs-2 col-sm-2"> Amount </label>
                            <?php echo form_error('data[salaryAmount]', '<div style="color: rgb(255, 0, 0);">', '</div>'); ?>
                            <input type="text" name="data[salaryAmount]" autocomplete="off" value="<?php echo set_value('data[salaryAmount]',false); ?>" placeholder="Amount" class="col-xs-6 col-sm-6" />
                           
                        </fieldset>
                       
                        <fieldset class="col-xs-12 col-sm-12">
                                <div class="col-xs-2 col-sm-2"><label>Date</label></div>
                                <?php echo form_error('data[date]', '<div style="color: rgb(255, 0, 0);">', '</div>'); ?>
                                <div class="input-group col-xs-6 col-sm-6">
                                    <input class="form-control date-picker" id="id-date-picker-1" type="text" name="data[date]" value="<?php echo set_value('data[date]',false); ?>" data-date-format="dd-mm-yyyy" />
                                    <span class="input-group-addon">
                                        <i class="fa fa-calendar bigger-110"></i>
                                    </span>
                                </div>
                        </fieldset>




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

                        <div class="form-actions center">
                            <button type="submit"  name="btnSave" class="btn btn-sm btn-success">
                                 <i class="ace-icon fa fa-check bigger-110"></i>
                                Save
                                
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div></div></div>
    
    
    
        <script>
function myFunction() {
    var x = document.getElementById("mySelect").value;
    if( x>=3 ){
        document.getElementById('customerSelect').style.visibility = "visible";
    document.getElementById("demo").innerHTML = "<label class='col-xs-2 col-sm-2'>Description </label><textarea name='data[description]' placeholder='Description' class='col-xs-6 col-sm-6' /><?php echo set_value('description',false); ?></textarea>";
    }
    else
    { document.getElementById("demo").innerHTML = " ";
    document.getElementById('customerSelect').style.visibility = "hidden";
    }
    
}

</script>
