<?php
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'discontinue-form',
    'enableAjaxValidation' => false,
    'enableClientValidation' => false,
        ));
?>   
<div class="tab-content">

    <div class="tab-pane active">
        <ul class="clearfix form-ul material">
            <?php echo $form->hiddenField($model, 'id'); ?>

            <li class="col-sm-4">
                <?php echo $form->dropDownList($model, 'product_category_id', MasProductCategory::getProductCategory(), array('data-label' => 'Product Category <span style="color:red">*</span>', 'data-validation' => 'required', 'empty' => 'Select', 'data-search' => 'true', 'disabled' => true)); ?>
            </li> 
            <li class="col-sm-4">
                <?php echo $form->textField($model, 'gmc_code', array('data-label' => 'GMC Code <span style="color:red">*</span>', 'data-validation' => 'required', 'readonly' => true)); ?>
            </li> 
            <li class="col-sm-4">
                <?php echo $form->textField($model, 'model_no', array('data-label' => 'Model No <span style="color:red">*</span>', 'data-validation' => 'required', 'readonly' => true)); ?>
            </li> 
            <li class="col-sm-3">
                <?php echo $form->dropDownList($model, 'discontinuing_month', Order::getmonths(), array('data-label' => 'Discontinuing Month <span style="color:red">*</span>', 'empty' => '-Select-')); ?>
            </li>
            <li class="col-sm-3">
                <?php echo $form->dropDownList($model, 'discontinuing_year', Order::getyear(), array('data-label' => 'Discontinuing Year <span style="color:red">*</span>', 'empty' => '-Select-')); ?>
            </li>


        </ul>
    </div>



</div>
<div class="modal-footer">
    <button type="button" class="btn btn-default" id="discontinue_close" data-dismiss="modal">Close</button>
    <?php
    $url = Yii::app()->createUrl('inventory/Savediscontinue');
    echo CHtml::ajaxSubmitButton('Save', $url, array(
        'dataType' => 'json',
        'type' => 'post',
        'success' => 'function(data) {
            $("#loader").hide();
                if(data.status=="success"){  
                    t8.success("GMC Saved Successfully!");
                    $("#discontinue_close").click();
                    reloadTable("#tbl_inventory_details");
                } else { 
                    $("#discontinue-form .discontinue-save-btn").prop("disabled", false);                      
                    $("#discontinue-form .discontinue-save-btn").addClass("btn-theme").removeClass("btn_loading"); 
                    $.each(data, function(key, val) {
                        t8.error(""+val+""); 
                    }); 
                } 
        }',
        'beforeSend' => 'function(){ 
            $("#loader").show();
            $(".toast8-error").hide();
            $("#discontinue-form .discontinue-save-btn").prop("disabled", true);                      
            $("#discontinue-form .discontinue-save-btn").addClass("btn_loading").removeClass("btn-theme"); 

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