/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Client::find();
     $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;
     }
     $query->andFilterWhere(['client_id' => $this->client_id, 'client_lat' => $this->client_lat, 'client_long' => $this->client_long, 'priority' => $this->priority, 'day' => $this->day]);
     $query->andFilterWhere(['like', 'client_name', $this->client_name]);
     $query->andFilterWhere(['like', 'client_address', $this->client_address]);
     return $dataProvider;
 }
Esempio n. 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Client::find();
     $query->joinWith(['user']);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->sort->attributes['user'] = ['asc' => ['user.username' => SORT_ASC], 'desc' => ['user.username' => SORT_DESC]];
     $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;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'kecamatan' => $this->kecamatan, 'kabkota' => $this->kabkota, 'propinsi' => $this->propinsi, 'latitude' => $this->latitude, 'longitude' => $this->longitude, 'industry_kecamatan' => $this->industry_kecamatan, 'industry_kabkota' => $this->industry_kabkota, 'industry_propinsi' => $this->industry_propinsi, 'surveyor_id' => $this->surveyor_id, 'created_date' => $this->created_date, 'updated_date' => $this->updated_date]);
     $query->andFilterWhere(['like', 'client_no', $this->client_no])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'nama_lengkap', $this->nama_lengkap])->andFilterWhere(['like', 'nama_keluarga', $this->nama_keluarga])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'alamat', $this->alamat])->andFilterWhere(['like', 'kode_pos', $this->kode_pos])->andFilterWhere(['like', 'identitas', $this->identitas])->andFilterWhere(['like', 'identitas_no', $this->identitas_no])->andFilterWhere(['like', 'no_hp', $this->no_hp])->andFilterWhere(['like', 'no_telp', $this->no_telp])->andFilterWhere(['like', 'fax', $this->fax])->andFilterWhere(['like', 'website', $this->website])->andFilterWhere(['like', 'note', $this->note])->andFilterWhere(['like', 'profile_picture', $this->profile_picture])->andFilterWhere(['like', 'company_name', $this->company_name])->andFilterWhere(['like', 'entrepeneur', $this->entrepeneur])->andFilterWhere(['like', 'sector', $this->sector])->andFilterWhere(['like', 'industry', $this->industry])->andFilterWhere(['like', 'type_industry', $this->type_industry])->andFilterWhere(['like', 'industry_address', $this->industry_address])->andFilterWhere(['like', 'industry_kode_pos', $this->industry_kode_pos])->andFilterWhere(['like', 'industry_telp', $this->industry_telp])->andFilterWhere(['like', 'industry_fax', $this->industry_fax])->andFilterWhere(['like', 'created_by', $this->created_by])->andFilterWhere(['like', 'updated_by', $this->updated_by])->andFilterWhere(['like', 'user.username', $this->user]);
     return $dataProvider;
 }
Esempio n. 3
0
 /**
  * Finds the Client model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Client the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Client::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getClients()
 {
     return $this->hasMany(Client::className(), ['client_id' => 'client_id'])->viaTable('route-client', ['route_id' => 'route_id']);
 }
<?php

use yii\helpers\Html;
use backend\models\Client;
use backend\models\Relevador;
/* @var $this yii\web\View */
/* @var $model backend\models\ClientSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Map');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="client-map">

    <?php 
$clients = \backend\models\Client::find()->asArray()->all();
$relevators = \backend\models\Relevador::find()->asArray()->all();
?>
    
    
<div id="map" style="height:800px; width:100%;"></div>

</div>

<script>

  // In the following example, markers appear when the user clicks on the map.
  // The markers are stored in an array.
  // The user can then click an option to hide, show or delete the markers.
  var map;
  var markers = [];
      
Esempio n. 6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getClient()
 {
     return $this->hasOne(Client::className(), ['id' => 'client_id']);
 }
Esempio n. 7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getClients()
 {
     return $this->hasMany(Client::className(), ['surveyor_id' => 'id']);
 }
Esempio n. 8
0
use backend\models\Client;
use kartik\widgets\DepDrop;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model backend\models\ClientSurvey */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="client-survey-form">

<?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'client_id')->dropDownList(ArrayHelper::map(Client::find()->all(), 'id', 'nama_lengkap'), ['prompt' => ''])->label('Client');
?>
	
	<?php 
echo $form->field($model, 'qa_trans_kwalitas_jalan')->radioList(array(1 => 'Jalan tanah atau batu dan hanya bisa dilewati oleh kendaraan roda dua.', 2 => 'Bisa dilewati kendaraan roda empat atau lebih, namun kwalitas buruk seperti: tanah, batu, aspal dengan moyoritas berlubang.', 3 => 'Hanya bisa dilewati oleh kendaraan roda dua tapi memiliki kwalitas struktur beton dan aspal baik. ', 4 => 'Bisa dilewati 1 kendaran roda empat, dengan dasar beton atau aspal dengan kwalitas baik.', 5 => 'Bisa dilewati kendaraan roda empat atau lebih yang berpapasan, serta memiliki struktur beton atau aspal dengan kwalitas baik.'))->label('Transportation - KWALITAS JALAN');
?>
	
	<?php 
echo $form->field($model, 'qa_energy_listrik')->radioList(array(1 => 'Tidak tersedia listrik PLN.', 2 => 'Kwalitas PLN kurang baik (listrik padam lebih dari 1x dalam satu bulan) dan TIDAK tersedia back-up jenset.', 3 => 'Kwalitas PLN baik (tidak pernah padam kurang dari 1 bulan) TIDAK tersedia back-up jenset', 4 => 'Kwalitas PLN kurang baik (listrik padam lebih dari 1x dalam satu bulan) dan disertai back-up jenset.', 5 => 'Kwalitas PLN baik (tidak pernah padam kurang dari 1 bulan) dan disertai back-up pembangkit mandiri (jenset)'))->label('Energy - LISTRIK');
?>
	
	
	<?php 
echo $form->field($model, 'qa_water_mng')->radioList(array(1 => 'Ketergantungan dengan air PAM dengan kwalitas tidak baik, dan tidak memiliki pengelolaan air limbah yang baik.', 2 => 'Ketergantungan dari air tanah namun TIDAK memiliki pengelolaan limbah usaha yang baik.', 3 => 'Kwalitas ketersediaan air PAM TIDAK baik atau TIDAK ADA tapi didukung oleh pengelolaan air tanah yang baik serta pengelolaan air limbah usaha yang baik.', 4 => 'Ketergantungan hanya terhadap air PAM dengan kwalitas baik dan pengelolaan limbah yang baik.', 5 => 'Kwalitas ketersediaan air PAM baik dan didukung oleh pengelolaan air tanah yang baik serta pengelolaan air limbah usaha yang baik.'))->label('Water Management - AIR');
?>