示例#1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Embalaje::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(['idEmbalaje' => $this->idEmbalaje]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre]);
     return $dataProvider;
 }
示例#2
0
文件: _form.php 项目: edgasanc/es-crm
?>

    <?php 
echo $form->field($model, 'codigo')->textInput();
?>

    <?php 
echo $form->field($model, 'producto')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'precio')->widget(MaskMoney::classname(), ['pluginOptions' => ['prefix' => '$ ', 'suffix' => '', 'thousands' => '.', 'decimal' => ',', 'allowNegative' => false]]);
?>

    <?php 
echo $form->field($model, 'embalaje_idEmbalaje')->widget(Select2::classname(), ['data' => ArrayHelper::map(Embalaje::find()->all(), 'idEmbalaje', 'nombre'), 'options' => ['placeholder' => 'Seleccione une opción'], 'pluginOptions' => ['allowClear' => true]]);
?>

    <?php 
echo $form->field($model, 'impuestos_idImpuesto')->widget(Select2::classname(), ['data' => ArrayHelper::map(Impuesto::find()->all(), 'idImpuesto', 'nombre'), 'options' => ['placeholder' => 'Seleccione une opción'], 'pluginOptions' => ['allowClear' => true]]);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>
示例#3
0
文件: index.php 项目: edgasanc/es-crm
/* @var $searchModel app\models\ProductoSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Productos');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="producto-index">

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

    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create {0}', Yii::t('app', 'Producto')), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'codigo', 'producto', 'precio:currency', ['attribute' => 'embalaje_idEmbalaje', 'filter' => Html::activeDropDownList($searchModel, 'embalaje_idEmbalaje', ArrayHelper::map(Embalaje::find()->asArray()->all(), 'idEmbalaje', 'nombre'), ['class' => 'form-control', 'prompt' => '']), 'value' => function ($model, $index, $dataColumn) {
    return $model->embalajeIdEmbalaje->nombre;
}], ['attribute' => 'impuestos_idImpuesto', 'filter' => Html::activeDropDownList($searchModel, 'impuestos_idImpuesto', ArrayHelper::map(Impuesto::find()->asArray()->all(), 'idImpuesto', 'nombre'), ['class' => 'form-control', 'prompt' => '']), 'value' => function ($model, $index, $dataColumn) {
    return $model->impuestosIdImpuesto->nombre;
}], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
示例#4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEmbalajeIdEmbalaje()
 {
     return $this->hasOne(Embalaje::className(), ['idEmbalaje' => 'embalaje_idEmbalaje']);
 }
示例#5
0
 /**
  * Finds the Embalaje model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Embalaje the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Embalaje::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }