Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Combrand::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'active', $this->active]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 public static function itemsAlias($key)
 {
     $items = ['eqmType' => ArrayHelper::map(Comequipmenttype::find()->all(), 'id', 'name'), 'comBrand' => ArrayHelper::map(Combrand::find()->all(), 'id', 'name'), 'warranty' => ArrayHelper::map(Comwarranty::find()->all(), 'id', 'name'), 'dealer' => ArrayHelper::map(Comdealer::find()->all(), 'id', 'dealerName'), 'location' => ArrayHelper::map(Section::find()->all(), 'id', 'name'), 'status' => [1 => 'กำลังใช้งาน', 2 => 'พร้อมใช้งาน', 3 => 'อยู่ระหว่างซ่อม', 4 => 'ส่งซ่อม', 5 => 'ชำรุด/ซ่อมไม่ได้', 6 => 'จำหน่ายออก']];
     return ArrayHelper::getValue($items, $key, []);
     //return array_key_exists($key, $items) ? $items[$key] : [];
 }
Ejemplo n.º 3
0
Archivo: _form.php Proyecto: poykub/wph
                                </div>
                                <?php 
/*<div class="col-md-4">
      <br><?= Html::button('<span class="glyphicon glyphicon-th"></span>', ['value' => Url::to('index.php?r=comstocklist/insertlist'), 'class' => 'btn btn-info', 'id' => 'modalButton','title'=>'จัดการรายการพัสดุ', 'data-toggle'=>'tooltip',]) ?>
  </div> */
?>
                            </div>
                            <div class="row">
                                <div class="col-md-4">
                                    <?php 
echo $form->field($model, 'eqmType')->widget(Select2::classname(), ['data' => ArrayHelper::map(Comequipmenttype::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'เลือกอุปกรณ์...'], 'pluginOptions' => ['allowClear' => true]]);
?>
                                </div>
                                <div class="col-md-4">
                                    <?php 
echo $form->field($model, 'brand')->widget(Select2::classname(), ['data' => ArrayHelper::map(Combrand::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'เลือกยี่ห้อ...'], 'pluginOptions' => ['allowClear' => true]]);
?>
                                </div>
                                <div class="col-md-4">
                                    <?php 
echo $form->field($model, 'model', ['inputOptions' => ['class' => 'form-control', 'placeholder' => 'ตัวอย่าง: CDX-1805-MD', 'autocomplete' => 'off']])->textInput(['maxlength' => 100]);
?>
                                </div>
                                <div class="col-md-4">
                                    <?php 
echo $form->field($model, 'price', ['inputOptions' => ['class' => 'form-control', 'placeholder' => 'ราคา', 'autocomplete' => 'off']])->textInput(['maxlength' => 20]);
?>
                                </div>
                                <div class="col-md-4">
                                    <?php 
echo $form->field($model, 'amount', ['inputOptions' => ['class' => 'form-control', 'placeholder' => 'จำนวนที่รับเข้าระบบ', 'autocomplete' => 'off']])->textInput(['maxlength' => 10]);
Ejemplo n.º 4
0
 /**
  * Finds the Combrand model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Combrand the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Combrand::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }