<ul class="clearfix form-ul material">
    <?php echo $form->hiddenField($model, 'id'); ?>
    <?php echo $form->hiddenField($model, 'is_lead_owner'); ?>
  <!--   <li class="col-sm-6">
        <?php //echo $form->dropdownList($model, 'hr_connected_employee_id', Employee::getEmployee(), array('data-label' => '<span style="color : red;"> Employee(* Connect with HR)</span>', 'data-search' => 'true', 'empty' => 'Select', 'onchange' => 'loademployeedetails();')); ?>
    </li> -->  
    <li class="col-sm-6">
        <?php echo $form->textField($model, 'first_name', array('data-label' => 'First Name <span style="color:red">*</span>', 'data-validation' => 'required')); ?>
        <?php echo $form->error($model, 'first_name'); ?>
    </li>
    <li class="col-sm-6">
        <?php echo $form->textField($model, 'last_name', array('data-label' => 'Last Name <span style="color:red">*</span>', 'data-validation' => 'required')); ?>
        <?php echo $form->error($model, 'last_name'); ?>
    </li>
    <li class="col-sm-6">
        <?php echo $form->textField($model, 'phno', array('data-label' => 'Phone Number <span style="color:red">*</span>', 'data-validation' => 'required')); ?>
        <?php echo $form->error($model, 'phno'); ?>
    </li>
    <li class="col-sm-6">
        <?php echo $form->textField($model, 'designation', array('data-label' => 'Designation')); ?>
        <?php echo $form->error($model, 'designation'); ?>
    </li>
    <li class="col-sm-6">
        <?php echo $form->textField($model, 'email', array('data-label' => 'Email <span style="color:red">*</span>', 'data-validation' => 'required')); ?>
        <?php echo $form->error($model, 'email'); ?>
    </li>

    <li class="col-sm-6">
        <?php echo $form->textField($model, 'username', array('data-label' => 'User Name <span style="color:red">*</span>', 'data-validation' => 'required')); ?>
        <?php echo $form->error($model, 'user_name'); ?>
    </li>
        <li class="col-sm-6">
            <?php
            $model->password = '';
            echo $form->passwordField($model, 'password', array(
                'data-label' => 'Password <span style="color:red">*</span>',
                'data-validation' => 'required',
            ));
            ?>
            <?php echo $form->error($model, 'password'); ?>
        </li>

    <?php
    $user_id   = (int) Yii::app()->user->id;                 
    $modeluser = User::model()->findByPk($user_id);          

    $hideStyle = ($modeluser->user_group_id != 1) ? 'display:none;' : ''; 
    ?>

    <li class="col-sm-6" style="<?php echo $hideStyle; ?>">  
        <?php
        $groupList = CHtml::listData(
            UserGroup::model()->findAll(['order' => 'id ASC']),
            'id',
            'group_name'
        );
        ?>

        <?php echo $form->dropDownList(
            $model,
            'user_group_id',
            $groupList,
            array(
                'class' => 'tooltipster',
                'data-label' => 'User Group<span style="color:red">*</span>',
                'prompt' => 'Select Group',
            )
        ); ?>
    </li>

<!--    <li class="col-sm-6" >
        <?php
/*        echo $form->labelEx($model, 'Signature(Max Size-30Kb-150W X 200H px)');
        $allowedExtensions = array("png", "jpg", "jpeg");
        $this->widget('ext.EAjaxUpload.EAjaxUpload', array(
            'id' => rand(),
            'config' => array(
                'action' => Yii::app()->createUrl(Yii::app()->controller->id . '/UploadSignature', array('folder' => 'uploads/signature')),
                'multiple' => false,
                'allowedExtensions' => $allowedExtensions,
                'sizeLimit' => 30 * 1024, //30kb
                'onStart' => "js:function(){}",
                'onComplete' => "js:function(id, fileName, responseJSON){
                                                              $('#User_signature').val(responseJSON.filename);
                                                              $('#div_signature_photo').html('<img width=\'100\' height=\'100\' src=\"" . Yii::app()->baseUrl . "/uploads/signature/'+responseJSON.filename+'\" />')
                                                       }",
            )
        ));
        ?>  
        <div class="each_image1">                  
<?php if ($model->id && $model->signature != ''): ?>
                <div id="div_signature_photo" class="each_image">
                    <img id="img_signature__photo" src="<?php echo Yii::app()->baseUrl; ?>/uploads/signature/<?php echo $model->signature; ?>" width='100' height='100' />
                </div>
<?php endif;*/ ?>
<?php //echo $form->hiddenField($model, 'signature'); ?>
        </div>

    </li>-->
    <li class="col-sm-12"></li>
  <!--   <fieldset class="box-style-1"> -->
<!--         <legend>HR Settings</legend>
 -->      <!--   <li class="col-sm-6">
            <?php
            if ($model->branch_id != '') {
                $model->branch_id = explode(',', $model->branch_id);
            }
            //echo $form->dropdownList($model, 'branch_id', MasCompanyBranchSponsor::getCompanyBranchesForUser(), array('data-label' => 'Branch<span style="color:red"> *</span>', 'data-search' => 'true', 'multiple' => 'true'));
            ?>
<?php //echo $form->error($model, 'branch_id'); ?>

        </li> -->
  <!--       <li class="col-sm-6">
<?php //echo $form->dropdownList($model, 'department_head_id', Employee::getEmployee(), array('data-label' => '<span style="color : red;"> Employee(* Dept Head Login)</span>', 'data-search' => 'true', 'empty' => 'Select')); ?>
        </li> -->
  <!--   </fieldset>   -->   
</ul>

<?php
$cs = Yii::app()->getClientScript();
$cs->registerScript("getpassword", "function getpassword(value)
    {
        var user_password = $('#hid_password').val();
        $('#User_password').val('');
    }", CClientScript::POS_HEAD);
$cs->registerScript("setpassword", "function setpassword()
    {
        var user_password = $('#hid_password').val();
        var new_password = $('#User_password').val();
        if(new_password=='')
        {
            $('#User_password').val(user_password);
        }
    }", CClientScript::POS_HEAD);

$cs->registerScript("loademployeedetails", "function loademployeedetails(){  
        var employee_id= $('#User_hr_connected_employee_id').val();
        jQuery.ajax({
           'dataType':'json',
            'data' : {'employee_id':employee_id},
            'type':'post',
            'url': '" . Yii::app()->createUrl('Users/getemployeedetails') . "',
            'success': function(data) {
               $('#User_first_name').val(data.first_name);
               $('#User_first_name').addClass('filled')
               $('#User_last_name').val(data.last_name);
               $('#User_last_name').addClass('filled')
               $('#User_phno').val(data.phone);
               $('#User_phno').addClass('filled')
               $('#User_email').val(data.email);
               $('#User_email').addClass('filled')
               $('#User_designation').val(data.designation_name);
               $('#User_designation').addClass('filled')
            },
            'beforeSend':function(){
                $('#loader').show();
            },
            'complete':function(){
                $('#loader').hide();
            }
        });
   
};", CClientScript::POS_HEAD);