<?php
$cs = Yii::app()->getClientScript();

$form = $this->beginWidget('CActiveForm', array(
    'id' => 'master_settings-form',
    'enableAjaxValidation' => false,
    'enableClientValidation' => false,
));
?>
<section class="panel">
    <header class="panel-heading clearfix panel-theame">
        <i class="fa fa-tasks"></i> Master Settings
    </header>
   
    <div class="tab-content">
        <div class="tab-pane active">
            <ul class="clearfix form-ul material">
                <li  class="col-sm-3">
                    <?php echo $form->hiddenField($model, 'id'); ?>
                    <?php echo $form->dropdownList($model, 'inventory_year',Order::getyear(),  array('data-label' => 'Inventory Year <span style="color:red">*</span>','empty'=>'-Select-')); ?>
                </li>
                <li class="col-sm-3">
                    <?php echo $form->dropDownList($model, 'inventory_month', Order::getmonths(), array('data-label' => 'Inventory Month <span style="color:red">*</span>','empty'=>'-Select-')); ?>
                </li>
                 <li  class="col-sm-3">
                  
                    <?php echo $form->dropdownList($model, 'unshipped_year',Order::getyear(),  array('data-label' => 'Unshipped Year <span style="color:red">*</span>','empty'=>'-Select-')); ?>
                </li>
                <li class="col-sm-3">
                    <?php echo $form->dropDownList($model, 'unshipped_month', Order::getmonths(), array('data-label' => 'Unshipped Month <span style="color:red">*</span>','empty'=>'-Select-')); ?>
                </li>
                <li class="col-sm-3">
                    <?php echo $form->textField($model,'currency_rate',array('data-label' => 'Currency Rate <span style="color:red">*</span>')); ?>
            </ul>
        </div>
    </div>
     <?php if (Yii::app()->user->authorised_user == 1 || isset(Yii::app()->user->havePermissionOn['master_setting_save_view'])) { ?>
<div class="modal-footer">
    <!--<button type="button" class="btn btn-default" id="master_settings_close" data-dismiss="modal">Close</button>-->
    <?php
    $url = Yii::app()->createUrl('mastersettings/SaveMasterSettings');
    echo CHtml::ajaxSubmitButton('Save', $url, array(
        'dataType' => 'json',
        'type' => 'post',
        'success' => 'function(data) {
            $("#loader").hide();
                if(data.status=="success"){  
                    t8.success("Settings  Saved Successfully!");
                    
                } else { 
                    $("#master_settings-form .master_settings-save-btn").prop("disabled", false);                      
                    $("#master_settings-form .master_settings-save-btn").addClass("btn-theme").removeClass("btn_loading"); 
                    $.each(data, function(key, val) {
                        t8.error(""+val+""); 
                    }); 
                } 
        }',
        'beforeSend' => 'function(){ 
            $("#loader").show();
            $(".toast8-error").hide();
            $("#master_settings-form .master_settings-save-btn").prop("disabled", true);                      
            $("#master_settings-form .master_settings-save-btn").addClass("btn_loading").removeClass("btn-theme"); 

        }'
    ), array('id' => 'mybtn' . rand(), 'class' => 'master_settings-save-btn btn btn-theme'));
    ?>
</div>
                          <?php }?>
</section>
<?php $this->endWidget(); ?>