<?php // $cs = Yii::app()->getClientScript(); ?>
 
<?php
 
$form = $this->beginWidget('CActiveForm', array(
 
    'id' => 'userproject-form',
 
    'enableAjaxValidation' => false,
 
    'enableClientValidation' => false,
 
    ));
 
?>
 
    <div class="tab-content">
 
        <div class="tab-pane active">
 
           
 
                   <ul class="clearfix form-ul material">
 
               
 
                <li class="col-sm-6">
                            <input type="hidden" name="from" id="from" value="<?php echo $from; ?>">
 
                    <?php echo $form->hiddenField($model, 'id');?>
 
                  <?php
echo $form->dropDownList(
    $model,
    'project_id',
    Projects::getAllProjects(),
    [
        'empty' => '-- Select Project --',
        'class' => 'form-control'
    ]
);
?>

 
 
                </li>

                  <li class="col-sm-6">
 
                <?php
echo $form->dropDownList(
    $model,
    'user_id',
    User::getUser(),
    [
        'empty' => '-- Select User --',
        'class' => 'form-control'
    ]
);
?>


 
                </li>

               
        
            </ul>
 
        </div>
 
     
 
    </div>
 
<div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
 
        <?php
                $url= Yii::app()->createUrl('/userprojects/Save');
               
                echo CHtml::ajaxSubmitButton('Save', $url, array(
 
                            'dataType' => 'json',
 
                            'type' => 'post',
 
                            'success' => 'function(data) {
 
                                    $("#loader").hide();
                                    if(data.status=="success"){  
 
                                         t8.success("Saved Successfully!");
 
                                        {
                                         $(".x.close").click();
                                         reloadTable("#tbl_user_projects");
                                         }
 
                                    } else {
 
                                        $("#project-form .projects-save-btn").prop("disabled", false);                      
                                        $("#project-form .projects-save-btn").addClass("btn-theme").removeClass("btn_loding");
                                        $.each(data, function(key, val) {
 
                                                $("#project-form #"+key+"_em_").text(val).show();
 
                                                t8.error(""+val+"");
 
                                            });
 
                                    }
 
                            }',
 
                            'beforeSend' => 'function(){
                                $("#loader").show();
                                $("#project-form .projects-save-btn").prop("disabled", true);                      
                                $("#project-form .projects-save-btn").addClass("btn_loding").removeClass("btn-theme");
                                $(".toast8-error").hide();
                            }'
                               
 
                    ), array('id' => 'mybtn' . rand(), 'class' => 'projects-save-btn btn btn-theme'));
 
       
 
    ?>
 
 
 
    </div>
 
<?php $this->endWidget(); ?>