Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CustomersImage::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['ID' => $this->ID, 'STATUS' => $this->STATUS, 'CREATE_AT' => $this->CREATE_AT, 'UPDATE_AT' => $this->UPDATE_AT]);
     $query->andFilterWhere(['like', 'CUST_KD', $this->CUST_KD])->andFilterWhere(['like', 'IMG_NM_BASE64', $this->IMG_NM_BASE64])->andFilterWhere(['like', 'CREATE_BY', $this->CREATE_BY])->andFilterWhere(['like', 'UPDATE_BY', $this->UPDATE_BY]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
$this->sideCorp = 'Customers';
/* Title Select Company pada header pasa sidemenu/menu samping kiri */
$this->sideMenu = $sideMenu_control;
//'umum_datamaster';   	 /* kd_menu untuk list menu pada sidemenu, get from table of database */
$this->title = Yii::t('app', 'Customers');
/* title pada header page */
// $parent = ArrayHelper::map(Customers::find()->where('STATUS<>3 and CUST_KD=CUST_GRP')->all(), 'CUST_KD', 'CUST_NM');
/*modal*/
Modal::begin(['id' => 'modal-view_cus-customer', 'header' => '<div style="float:left;margin-right:10px" class="fa fa-user"></div><div><h5 class="modal-title"><b>VIEW CUSTOMERS</b></h5></div>', 'size' => Modal::SIZE_LARGE, 'headerOptions' => ['style' => 'border-radius:5px; background-color: rgba(74, 206, 231, 1)']]);
echo "<div id='modalContentcustomers'></div>";
Modal::end();
/*CUSTOMER DATA*/
$tabcustomersData = \kartik\grid\GridView::widget(['id' => 'gv-cus-erp', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'filterRowOptions' => ['style' => 'background-color:rgba(255, 154, 48, 1); align:center'], 'columns' => [['class' => 'kartik\\grid\\SerialColumn', 'contentOptions' => ['class' => 'kartik-sheet-style'], 'width' => '10px', 'header' => 'No.', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(255, 154, 48, 1)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]], ['class' => 'kartik\\grid\\ExpandRowColumn', 'width' => '50px', 'header' => 'Detail', 'value' => function ($model, $key, $index, $column) {
    return GridView::ROW_COLLAPSED;
}, 'detail' => function ($model, $key, $index, $column) {
    $modelCustImg = CustomersImage::find()->where(['CUST_KD' => $model->CUST_KD])->asArray()->all();
    //$searchModelImg = new CustomersImageSearch(['CUST_KD'=>$model->CUST_KD]);
    //$dataProviderImg = $searchModel->search(Yii::$app->request->queryParams);
    return Yii::$app->controller->renderPartial('_expand1', ['modelCust' => $model, 'modelCustImg' => $modelCustImg]);
}, 'collapseTitle' => 'Close Exploler', 'expandTitle' => 'Click to views detail', 'expandOneOnly' => true, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(74, 206, 231, 1)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'height' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '9pt']]], ['class' => '\\kartik\\grid\\CheckboxColumn', 'contentOptions' => ['class' => 'kartik-sheet-style'], 'width' => '10px', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'verdana, arial, sans-serif', 'font-size' => '9pt', 'background-color' => 'rgba(255, 154, 48, 1)']], 'contentOptions' => ['style' => ['text-align' => 'center', 'width' => '10px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]], ['attribute' => 'parentName', 'label' => 'Customer Group', 'filterType' => GridView::FILTER_SELECT2, 'filter' => $parent, 'filterOptions' => ['colspan' => 2], 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'contentOptions' => ['style' => ['text-align' => 'left', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]]], 'filterInputOptions' => ['placeholder' => 'Parent Customer'], 'hAlign' => 'left', 'vAlign' => 'top', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '250px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(255, 154, 48, 1)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '250px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']], 'group' => true], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'CUST_KD', 'refreshGrid' => true, 'readonly' => function ($model, $key, $index, $widget) {
    // readonly
    if ($model->CUST_GRP == $model->CUST_KD) {
        return true;
    } else {
        return false;
    }
}, 'label' => 'Customer.Id', 'hAlign' => 'left', 'vAlign' => 'top', 'filter' => false, 'mergeHeader' => true, 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '120px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(255, 154, 48, 1)']], 'contentOptions' => ['style' => ['vertical-align' => 'text-middle', 'text-align' => 'left', 'width' => '120px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']], 'editableOptions' => ['header' => 'Customers', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'size' => 'md', 'options' => ['data' => $parent, 'pluginOptions' => ['allowClear' => true]]]], ['attribute' => 'CUST_NM', 'label' => 'Customer Name', 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '250px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(255, 154, 48, 1)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '250px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]], ['attribute' => 'cus.CUST_KTG_NM', 'label' => 'Category', 'filter' => $dropType, 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '100px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(255, 154, 48, 1)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '100px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]], ['attribute' => 'custype.CUST_KTG_NM', 'filter' => $dropKtg, 'label' => 'Type', 'hAlign' => 'left', 'vAlign' => 'middle', 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '230px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(255, 154, 48, 1)']], 'contentOptions' => ['style' => ['text-align' => 'left', 'width' => '230px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'GEO', 'refreshGrid' => true, 'label' => 'Geo', 'hAlign' => 'left', 'vAlign' => 'top', 'filter' => true, 'filterType' => GridView::FILTER_SELECT2, 'filter' => $data_group, 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'contentOptions' => ['style' => ['text-align' => 'left', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]]], 'filterInputOptions' => ['placeholder' => 'Select'], 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '120px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(255, 154, 48, 1)']], 'contentOptions' => ['style' => ['vertical-align' => 'text-middle', 'text-align' => 'center', 'width' => '120px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']], 'editableOptions' => ['header' => 'GEO', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'size' => 'xs', 'options' => ['data' => $data_group, 'pluginOptions' => ['allowClear' => true]], 'displayValueConfig' => $data_group]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'LAYER', 'refreshGrid' => true, 'label' => 'Layer', 'hAlign' => 'left', 'vAlign' => 'top', 'filter' => true, 'filterType' => GridView::FILTER_SELECT2, 'filter' => $data_layer, 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'contentOptions' => ['style' => ['text-align' => 'left', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]]], 'filterInputOptions' => ['placeholder' => 'Select'], 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '120px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(255, 154, 48, 1)']], 'contentOptions' => ['style' => ['vertical-align' => 'text-middle', 'text-align' => 'center', 'width' => '120px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']], 'editableOptions' => ['header' => 'layer', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'size' => 'xs', 'options' => ['data' => $data_layer, 'pluginOptions' => ['allowClear' => true]], 'displayValueConfig' => $data_layer]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'DC_STATUS', 'refreshGrid' => true, 'hAlign' => 'left', 'vAlign' => 'top', 'filter' => true, 'filterType' => GridView::FILTER_SELECT2, 'filter' => $arraySttDC, 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'contentOptions' => ['style' => ['text-align' => 'left', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']]]], 'filterInputOptions' => ['placeholder' => 'Select'], 'headerOptions' => ['style' => ['text-align' => 'center', 'width' => '120px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt', 'background-color' => 'rgba(255, 154, 48, 1)']], 'contentOptions' => ['style' => ['vertical-align' => 'text-middle', 'text-align' => 'center', 'width' => '120px', 'font-family' => 'tahoma, arial, sans-serif', 'font-size' => '8pt']], 'editableOptions' => ['header' => 'INVENTORY', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'size' => 'xs', 'options' => ['data' => $arraySttDC, 'pluginOptions' => ['allowClear' => true]], 'displayValueConfig' => $arraySttDC]], ['attribute' => 'STATUS', 'filter' => $valStt, 'format' => 'raw', 'hAlign' => 'center', 'value' => function ($model) {
    if ($model->STATUS == 1) {
        return Html::a('<i class="fa fa-edit"></i> &nbsp;Enable', '', ['class' => 'btn btn-success btn-xs', 'title' => 'Aktif']);
    } else {
        if ($model->STATUS == 0) {
 /**
  * Finds the CustomersImage model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return CustomersImage the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = CustomersImage::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }