예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Comdealer::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, 'postcode' => $this->postcode]);
     $query->andFilterWhere(['like', 'dealerName', $this->dealerName])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'tambon', $this->tambon])->andFilterWhere(['like', 'amphur', $this->amphur])->andFilterWhere(['like', 'province', $this->province])->andFilterWhere(['like', 'tel', $this->tel])->andFilterWhere(['like', 'active', $this->active]);
     return $dataProvider;
 }
예제 #2
0
파일: Comstock.php 프로젝트: poykub/wph
 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] : [];
 }
예제 #3
0
파일: _form.php 프로젝트: poykub/wph
echo $form->field($model, 'serial', ['inputOptions' => ['class' => 'form-control', 'placeholder' => 'SN:0123456789', 'autocomplete' => 'off']])->textInput(['maxlength' => 45]);
?>
                                </div>
                                <div class="col-md-4">
                                    <?php 
echo $form->field($model, 'warranty')->widget(Select2::classname(), ['data' => ArrayHelper::map(Comwarranty::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'การรับประกัน...'], 'pluginOptions' => ['allowClear' => true]]);
?>
                                </div>
                                <div class="col-md-4">
                                    <?php 
echo $form->field($model, 'addToSystem')->widget(DatePicker::classname(), ['options' => ['placeholder' => 'เลือกวันที่ ...'], 'language' => 'th', 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd', 'todayHighlight' => true]]);
?>
                                </div>
                                <div class="col-md-4">
                                    <?php 
echo $form->field($model, 'dealer')->widget(Select2::classname(), ['data' => ArrayHelper::map(Comdealer::find()->all(), 'id', 'dealerName'), 'options' => ['placeholder' => 'ร้านค้า/ผู้จำหน่าย...'], 'pluginOptions' => ['allowClear' => true]]);
?>
                                </div>
                                <div class="col-md-3">
                                    <?php 
echo $form->field($model, 'location')->widget(Select2::classname(), ['data' => ArrayHelper::map(Section::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'หน่วยงาน/ฝ่าย/แผนก...'], 'pluginOptions' => ['allowClear' => true]]);
?>
                                </div>
                                <div class="col-md-5">
                                    <?php 
echo $form->field($model, 'status')->inline(true)->radiolist(['1' => 'กำลังใช้งาน', '2' => 'พร้อมใช้งาน', '3' => 'ส่งซ่อม', '4' => 'ชำรุด', '5' => 'จำหน่ายออก']);
?>
                                </div>

                            </div>
                        </div>
예제 #4
0
파일: Comkarupan.php 프로젝트: poykub/wph
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDealer_role()
 {
     return $this->hasOne(Comdealer::className(), ['id' => 'dealer']);
 }
예제 #5
0
 /**
  * Finds the Comdealer model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Comdealer the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Comdealer::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #6
0
파일: Helpdesk.php 프로젝트: poykub/wph
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSentDealer()
 {
     return $this->hasOne(Comdealer::className(), ['id' => 'sentDealer']);
 }