/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = JenisMotor::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]);
     $query->andFilterWhere(['like', 'nama', $this->nama])->andFilterWhere(['like', 'keterangan', $this->keterangan]);
     return $dataProvider;
 }
示例#2
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\Motor */
/* @var $form yii\widgets\ActiveForm */
?>

<?php 
//use app\models\Country;
$jenismotor = \app\models\JenisMotor::find()->all();
$listData = \yii\helpers\ArrayHelper::map($jenismotor, 'id', 'nama');
?>
<div class="alert alert-block" style="background-color : lightgreen;">
    <button type="button" class="close" data-dismiss="alert">&times;</button>
    <h4>Info:</h4>
    <li>Pastikan Setelah Input <b>Data Motor</b>, Input juga <b>Data Posisi</b> dan <b>Data Kondisi</b> Motor.
</div>
<div class="motor-form">

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

    <?php 
echo $form->field($model, 'id_jenis')->dropDownList($listData, ['prompt' => 'PILIH JENIS MOTOR ..']);
?>

    <?php 
echo $form->field($model, 'warna')->textInput(['maxlength' => true]);
示例#3
0
 public function getJenisMotor0()
 {
     return $this->hasOne(JenisMotor::className(), ['id' => 'id_jenis']);
 }
示例#4
0
 /**
  * Finds the JenisMotor model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id_jenis
  * @param string $nama_jenis
  * @return JenisMotor the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id_jenis, $nama_jenis)
 {
     if (($model = JenisMotor::findOne(['id_jenis' => $id_jenis, 'nama_jenis' => $nama_jenis])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#5
0
$this->title = 'Kondisi Motor';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="kondisi-motor-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('Buat Data Kondisi Motor', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <div class="table-responsive">
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'id_motor', 'value' => 'id_motor', 'contentOptions' => ['style' => 'width: 75px;']], ['attribute' => 'jenisMotor0.nama', 'value' => 'motor0.jenisMotor0.nama', 'filter' => Html::activeDropDownList($searchModel, 'nama', \yii\helpers\ArrayHelper::map(\app\models\JenisMotor::find()->select('nama')->distinct()->all(), 'nama', 'nama'), ['class' => 'form-control', 'prompt' => 'Semua'])], ['attribute' => 'no_totok', 'value' => 'motor0.no_totok', 'contentOptions' => ['style' => 'width: 75px;']], ['attribute' => 'no_rangka', 'value' => 'motor0.no_rangka'], ['attribute' => 'no_mesin', 'value' => 'motor0.no_mesin'], ['attribute' => 'kondisi', 'format' => 'raw', 'filter' => Html::activeDropDownList($searchModel, 'kondisi', \yii\helpers\ArrayHelper::map(\app\models\KondisiMotor::find()->select('kondisi')->distinct()->all(), 'kondisi', 'kondisi'), ['class' => 'form-control', 'prompt' => 'Semua']), 'value' => function ($row) {
    $values = ['siap jual' => 'success', 'sedang disiapkan' => 'info', 'belum siap' => 'warning', 'rusak' => 'danger'];
    return Html::tag('span', $row->kondisi, ['class' => 'label label-' . $values[$row->kondisi] . ''], ['style' => 'text-size:14px']);
}], 'keterangan', ['class' => \yii\grid\ActionColumn::className(), 'template' => '{delete} {update}']]]);
?>

    </div>
</div>

示例#6
0
                <li><a href="export">Download Data Penjualan Motor</a></li>
            </ul>
        </div>
        <!--
        <div class="col-md-2">
            <p>
                <a href="chart"><button type="button" class="btn btn-primary" style="margin-left: 10px;">
                        <span class="glyphicon glyphicon-stats" aria-hidden="true"></span> Grafik Penjualan Motor
                    </button></a>

                <a href="export"><button type="button" class="btn btn-primary" style="margin-left: 10px;">
                        <span class="glyphicon glyphicon-print" aria-hidden="true"></span> Download Data Penjualan Motor
                    </button></a>

            </p>
        </div>-->
        </div>

    <div class="table-responsive">
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'tableOptions' => ['class' => 'table table-striped table-bordered'], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', ['attribute' => 'jenisMotor0.nama', 'value' => 'motor0.jenisMotor0.nama', 'filter' => Html::activeDropDownList($searchModel, 'nama', \yii\helpers\ArrayHelper::map(\app\models\JenisMotor::find()->select('nama')->distinct()->all(), 'nama', 'nama'), ['class' => 'form-control', 'prompt' => 'Semua'])], ['attribute' => 'nama_lengkap', 'value' => 'pembeli0.nama_lengkap'], 'tipe_pembayaran', 'harga', ['attribute' => 'tgl', 'value' => 'tgl', 'format' => 'raw', 'contentOptions' => ['style' => 'width: 150px;'], 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'tgl', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']])], ['attribute' => 'foto_nota', 'format' => 'html', 'value' => function ($data) {
    return Html::img(Yii::getAlias('@web') . '/uploads/nota/' . $data['foto_nota'], ['width' => '70px']);
}], ['attribute' => 'foto_ktp', 'format' => 'html', 'value' => function ($data) {
    return Html::img(Yii::getAlias('@web') . '/uploads/ktp/' . $data['foto_ktp'], ['width' => '70px']);
}], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {update} {delete}', 'buttons' => ['update' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url);
}]]]]);
?>
</div>
</div>
示例#7
0
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel app\models\FakturSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Data Faktur';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="faktur-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('Buat Data Faktur', ['create'], ['class' => 'btn btn-success']);
?>
    </p>
    <div class="table-responsive">
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'no_faktur', 'nama_penerima', 'tgl_faktur', ['attribute' => 'jenisMotor0.nama', 'value' => 'penjualan0.motor0.jenisMotor0.nama', 'filter' => Html::activeDropDownList($searchModel, 'nama', \yii\helpers\ArrayHelper::map(\app\models\JenisMotor::find()->select('nama')->distinct()->all(), 'nama', 'nama'), ['class' => 'form-control', 'prompt' => 'Semua'])], ['attribute' => 'Nama Pembeli', 'value' => 'pembeli0.nama_lengkap'], ['attribute' => 'Tgl Penjualan', 'value' => 'penjualan0.tgl'], ['class' => 'yii\\grid\\ActionColumn']]]);
?>
    </div>
</div>