Exemplo n.º 1
0
 public function actionValidasi()
 {
     /* Author: -wawan- :validasi salesman-order*/
     if (\Yii::$app->user->isGuest) {
         $model = new LoginForm();
         return $this->render('index_nologin', ['model' => $model]);
     } else {
         $ModelUser = UserloginSearch::findUserAttr(Yii::$app->user->id)->one();
         $model = $this->findModel1($ModelUser->emp->EMP_ID);
         $searchModel1 = new EmployeSearch();
         $dataProvider = $searchModel1->search_empid($ModelUser->emp->EMP_ID);
         $js = '$("#confirm-permission-alert").modal("show")';
         $this->getView()->registerJs($js);
         // echo  \yii\helpers\Json::encode($dataProvider);
         //print_r($dataProvider->getModels());
         return $this->render('index', ['model' => $model, 'dataProvider' => $dataProvider->getModels()]);
     }
 }
Exemplo n.º 2
0
 public function actionIndex()
 {
     /*
      * SEARCH FIRST AND DIRECT
      * @author piter [ptr.nov@gmail.com]
      * @since 1.2
      */
     $paramCari = Yii::$app->getRequest()->getQueryParam('id');
     if ($paramCari != '') {
         $cari = ['EMP_ID' => $paramCari];
     } else {
         $cari = '';
     }
     /*	variable content View Employe Author: -ptr.nov- */
     $searchModel = new EmployeSearch($cari);
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     /*	variable content View Additional Author: -ptr.nov- */
     //$searchFilter = $searchModel->searchALL(Yii::$app->request->queryParams);
     $searchModel1 = new EmployeSearch();
     $dataProvider1 = $searchModel1->search_resign(Yii::$app->request->queryParams);
     /*SHOW ARRAY YII Author: -Devandro-*/
     //print_r($dataProvider->getModels());
     /*SHOW ARRAY JESON Author: -ptr.nov-*/
     //echo  \yii\helpers\Json::encode($dataProvider->getModels());
     if (Yii::$app->request->post('hasEditable')) {
         // instantiate your book model for saving
         $EMP_ID = Yii::$app->request->post('editableKey');
         $model = Employe::findOne($EMP_ID);
         // store a default json response as desired by editable
         $out = Json::encode(['output' => '', 'message' => '']);
         // fetch the first entry in posted data (there should
         // only be one entry anyway in this array for an
         // editable submission)
         // - $posted is the posted data for Book without any indexes
         // - $post is the converted array for single model validation
         $post = [];
         $posted = current($_POST['Employe']);
         $post['Employe'] = $posted;
         // load model like any single model validation
         if ($model->load($post)) {
             // can save model or do something before saving model
             $model->save();
             // custom output to return to be displayed as the editable grid cell
             // data. Normally this is empty - whereby whatever value is edited by
             // in the input by user is updated automatically.
             $output = '';
             // specific use case where you need to validate a specific
             // editable column posted when you have more than one
             // EditableColumn in the grid view. We evaluate here a
             // check to see if buy_amount was posted for the Book model
             if (isset($posted['EMP_NM'])) {
                 // $output =  Yii::$app->formatter->asDecimal($model->EMP_NM, 2);
                 $output = $model->EMP_NM;
             }
             // similarly you can check if the name attribute was posted as well
             // if (isset($posted['name'])) {
             //   $output =  ''; // process as you need
             // }
             $out = Json::encode(['output' => $output, 'message' => '']);
         }
         // return ajax json encoded response and exit
         echo $out;
         return;
     }
     //$generate_key_emp= Yii::$app->ambilkonci->getKey_Employe('GSN');
     //print_r($generate_key_emp);
     //$model = $this->findModel('ALG.2015.000056');
     return $this->render('index', ['searchModel' => $searchModel, 'dinamkkColumn1' => $this->gvColumn1(), 'dinamkkColumn2' => $this->gvColumn2(), 'dataProvider' => $dataProvider, 'searchModel1' => $searchModel1, 'dataProvider1' => $dataProvider1, 'aryCorpID' => $this->aryCorpID(), 'aryDept' => $this->aryDept(), 'aryDeptSub' => $this->aryDeptSub(), 'aryGrpFnc' => $this->aryGrpFnc(), 'arySeq' => $this->arySeq(), 'aryJab' => $this->aryJab(), 'aryStt' => $this->aryStt()]);
 }