<?php 
/********************************************************************************* 
 *  This file is part of Sentrifugo.
 *  Copyright (C) 2014 Sapplica
 *   
 *  Sentrifugo is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Sentrifugo is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Sentrifugo.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  Sentrifugo Support <support@sentrifugo.com>
 ********************************************************************************/
?>

<?php
if($this->nodata !='')
{
    $err_arr = array('identity'=>'Identity codes','roles'=>'Roles','referred'=>'Employees','candidate'=>'Selected candidates');
?>
<div class="ml-alert-1-info m1-info-set-2">
    <div class="style-1-icon info"></div>
    User cannot be created as the <?php echo $err_arr[$this->nodata];?> are not configured yet.
</div>
<?php
}
else 
{
    $messages = $this->messages; 
    $data = $this->data;
    sapp_Global::generateClientValidations($this->form);
?>

<div id="error_message" style="display:none;"></div>
<form name="<?php echo $this->form->getName(); ?>" id="<?php echo $this->form->getId(); ?>" method="<?php echo $this->form->getMethod(); ?>">
    <input type="hidden" name="tmp_emp_name" id="tmp_emp_name" />
<?php echo $this->form->id;
      echo $this->form->company_id;
?>
<div class="total-form-controller">       
        <div id="tabs">
        <div class="poc-ui-data-control">
            <div class="left-block-ui-data">
                <ul>
                    <li class="tab_selector"><a href="#tabs-1">General Information</a></li>
                </ul>
             </div>   
         <div class="right-block-data right-over-border">
            <div id="tabs-1" class="tab_content">
                <div class="new-form-ui">
                    <label><?php echo $this->form->employeeId->getLabel(); ?></label>
                    <div class="division">                        
                    <?php
                    if($this->form->id->getValue() == '')
                    {
                        echo $this->form->employeeId; 
                        ?>
                        <span id="errors-employeeId" class="errors"><?php echo isset($messages['employeeId'])?$messages['employeeId']:"";?></span>
                    <?php 
                    }
                    else 
                    {
                    ?>
                        <select disabled>
                            <option><?php echo $this->form->employeeId->getValue();?></option>
                        </select>
                    <?php 
                    }
                    ?>
                    </div>
                </div>
                
                <div class="new-form-ui" id="iddiv_fullname">
                    <label class="required"><?php echo $this->form->userfullname->getLabel(); ?></label>
                    <div class="division"><?php echo $this->form->userfullname; ?></div>
                </div>                
               
                <div class="new-form-ui">
                    <label class="required"><?php echo $this->form->emailaddress->getLabel(); ?></label>
                    <div class="division"><?php echo $this->form->emailaddress; ?></div>
                </div>
                
                <div class="new-form-ui">
                    <label class="required"><?php echo $this->form->emprole->getLabel(); ?></label>
                    <div class="division"><?php echo $this->form->emprole; ?>
                    <span id="errors-emprole" class="errors"><?php echo isset($messages['emprole'])?$messages['emprole']:"";?></span>
                    </div>
                </div>
                <div class="new-form-ui textareaheight">
	                 <label><?php echo $this->form->entrycomments->getLabel(); ?></label>
                    <div class="division"><?php echo $this->form->entrycomments; ?></div>
                </div>    
                <?php
                if($this->form->id->getValue() != '')
                {
                    if($data['isactive'] < 2)
                    {
                ?>
                    <div class="new-form-ui">
                        <label><?php 
                        if($data['isactive'] == 1)
                        {
                            echo "Check to inactivate";
                        }
                        else if($data['isactive'] == 0)
                        {
                            echo "Check to activate";
                        }
                        ?></label>
                        <div class="division"><?php echo $this->form->act_inact; ?></div>
                    </div>
                <?php
                    }
                }
                ?>
            </div>
            </div>   
           </div>          
        </div><!-- end of tags div -->
        
</div><!-- end of total form div-->
    <div class="new-form-ui-submit">
        <?php echo $this->form->submit; ?>
        <button onclick="window.location.href='<?php echo BASE_URL; ?>usermanagement';" type="button" id="Cancel" name="Cancel" title='Go back to list.'>Cancel</button>
    </div>
</form>
<script type="text/javascript" language="javascript">
$(document).ready(function(){
    $( "#tabs" ).tabs({
beforeActivate: function( event, ui ) {
   var id =ui.newPanel.prop('id'); 
   if(id == 'tabs-1')
    {
        ui.newPanel.parent().addClass('right-over-border');
    }
    else
    {
        ui.newPanel.parent().removeClass('right-over-border');
    }
}
}).addClass( "ui-tabs-vertical ui-helper-clearfix" );
    $( "#tabs li" ).removeClass( "ui-corner-top" ).addClass( "ui-corner-left" );
     $( "#selecteddate,#emplockeddate" ).datepicker({
        showOn: "both",
        buttonImage: "<?php echo MEDIA_PATH;?>images/cal.png",
        buttonImageOnly: true,
        buttonText: "",
        changeMonth: true,
        changeYear: true,
        dateFormat:"<?php echo DATEFORMAT_JS;?>"
        });
               
        $('#submit').click(function(){            
             $.blockUI({ width:'50px',message: $("#spinner").html() });
        });
	
		
});//end of ready function.
</script>
<?php 
}
?>