protected function findModel($id) { if (($model = Companies::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Companies::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->orFilterWhere(['like', 'company_name', $this->globalSearch])->orFilterWhere(['like', 'company_email', $this->globalSearch])->orFilterWhere(['like', 'company_address', $this->globalSearch])->orFilterWhere(['like', 'company_status', $this->globalSearch]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Companies::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $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->orFilterWhere(['like', 'company_name', $this->globalSearch])->orFilterWhere(['like', 'company_email', $this->globalSearch])->orFilterWhere(['like', 'company_address', $this->globalSearch])->orFilterWhere(['like', 'company_status', $this->globalSearch]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Companies::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(['company_id' => $this->company_id, 'company_start_date' => $this->company_start_date, 'company_created_date' => $this->company_created_date]); $query->andFilterWhere(['like', 'company_name', $this->company_name])->andFilterWhere(['like', 'company_email', $this->company_email])->andFilterWhere(['like', 'company_address', $this->company_address])->andFilterWhere(['like', 'company_status', $this->company_status]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Companies::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { return $dataProvider; } /*$query->andFilterWhere([ 'company_id' => $this->company_id, 'company_created_date' => $this->company_created_date, 'company_start_date' => $this->company_start_date, ]);*/ $query->orFilterWhere(['like', 'company_name', $this->globalSearch])->orFilterWhere(['like', 'company_email', $this->globalSearch])->orFilterWhere(['like', 'company_address', $this->globalSearch])->orFilterWhere(['like', 'company_status', $this->globalSearch]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getCompaniesCompany() { return $this->hasOne(Companies::className(), ['company_id' => 'companies_company_id']); }
use backend\models\Companies; use kartik\select2\Select2; /* @var $this yii\web\View */ /* @var $model backend\models\Branches */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="branches-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'companies_company_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name'), 'language' => 'en', 'options' => ['placeholder' => 'Выберите компанию'], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'branch_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'branch_address')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'branch_status')->dropDownList(['active' => 'Active', 'inactive' => 'Inactive'], ['prompt' => '']); ?>
use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; use backend\models\Companies; /* @var $this yii\web\View */ /* @var $model backend\models\Branches */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="branches-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'companies_company_id')->dropDownList(ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name'), ['prompt' => 'Select Company']); ?> <?php echo $form->field($model, 'branch_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'branch_address')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'branch_created_date')->textInput(); ?> <?php
use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; /* @var $this yii\web\View */ /* @var $model backend\models\Departments */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="departments-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'companies_company_id')->dropDownList(ArrayHelper::map(\backend\models\Companies::find()->all(), 'company_id', 'company_name'), ['prompt' => 'Select Company', 'onchange' => ' $.post("index.php?r=branches/list&id="+$(this).val(), function(data){ $("select#departments-branches_branch_id").html(data); }) ']); ?> <?php echo $form->field($model, 'branches_branch_id')->dropDownList(ArrayHelper::map(\backend\models\Branches::find()->all(), 'branch_id', 'branch_name'), ['prompt' => 'Select Company']); ?> <?php echo $form->field($model, 'department_name')->textInput(['maxlength' => true]); ?> <?php
/* @var $form yii\widgets\ActiveForm */ ?> <div class="departments-form"> <?php $form = ActiveForm::begin(); ?> <!-- <?php echo $form->field($model, 'companies_company_id')->textInput(); ?> --> <?php echo $form->field($model, 'companies_company_id')->dropDownList(ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name'), ['prompt' => 'Please choose company', 'onchange' => ' $.post("index.php?r=branches/lists&id=' . '"+$(this).val(),function(data){ $("select#departments-branches_branch_id").html(data); });']); ?> <!-- <?php echo $form->field($model, 'branches_branch_id')->textInput(); ?> --> <?php echo $form->field($model, 'branches_branch_id')->dropDownList(ArrayHelper::map(Branches::find()->all(), 'branch_id', 'branch_name'), ['prompt' => 'Please choose branch']); ?>
use backend\models\Companies; use backend\models\Branches; use kartik\select2\Select2; /* @var $this yii\web\View */ /* @var $model backend\models\Departments */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="departments-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'companies_company_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name'), 'options' => ['placeholder' => 'Select a state ...', 'onchange' => '$.post("index.php?r=departments/brancheslist&id=' . '"+$(this).val(),function(data){ $("#departments-branches_branch_id").html(data); });'], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'branches_branch_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Branches::find()->all(), 'branch_id', 'branch_name'), 'options' => ['placeholder' => 'Select a Branch ...'], 'pluginOptions' => ['allowClear' => true]]); ?> <?php // echo $form->field($model, 'companies_company_id')->dropDownList( // // ArrayHelper::map(Companies::find()->all(),'company_id','company_name'), // [ // 'prompt' => 'Select Company',
<?php echo $form->field($model, 'company_status')->dropDownList(['active' => 'Active', 'inactive' => 'Inactive'], ['prompt' => '']); ?> ------------------------------------------------------------------------------下面是branch--------------------------------------------------------------------------------------------- <!-- ------------------------------------------------------------------为这一个copany新建branch---------------------------------------------------------------------- --> <!--<?php echo $form->field($branch, 'companies_company_id')->textInput(); ?> --> <!--<?php echo $form->field($branch, 'companies_company_id')->dropDownList(ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name'), ['prompt' => 'Please choose company']); ?> --> <!--<?php echo $form->field($branch, 'companies_company_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name'), 'language' => 'en', 'options' => ['placeholder' => 'Select a state ...'], 'pluginOptions' => ['allowClear' => true]]); ?> --> <?php echo $form->field($branch, 'branch_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($branch, 'branch_address')->textInput(['maxlength' => true]); ?> <!--<?php echo $form->field($branch, 'branch_create_data')->textInput(); ?> --> <?php echo $form->field($branch, 'branch_create_data')->widget(DatePicker::className(), ['inline' => false, 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]);
public function getDropDownCompanies() { return ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name'); }
use yii\widgets\ActiveForm; use backend\models\Branches; use backend\models\Companies; /* @var $this yii\web\View */ /* @var $model backend\models\Departments */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="departments-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'companies_company_id')->dropDownList(ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name'), ['prompt' => 'Выберите компанию', 'onchange' => '$.post("index.php?r=branches/lists&id=" + $(this).val(), function( data ){ $("select#departments-branches_branch_id").html( data ); });']); ?> <?php echo $form->field($model, 'branches_branch_id')->dropDownList(ArrayHelper::map(Branches::find()->all(), 'branch_id', 'branch_name'), ['prompt' => 'Выберите бранч']); ?> <?php echo $form->field($model, 'department_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'department_status')->dropDownList(['active' => 'Active', 'inactive' => 'Inactive'], ['prompt' => '']); ?>
use yii\widgets\ActiveForm; use backend\models\Companies; use kartik\select2\Select2; /* @var $this yii\web\View */ /* @var $model backend\models\Branches */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="branches-form"> <?php $form = ActiveForm::begin(['id' => $model->formName()]); ?> <?php echo $form->field($model, 'companies_company_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name'), 'options' => ['placeholder' => 'Select a company ...']]); ?> <?php echo $form->field($model, 'branch_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'branch_address')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'branch_status')->dropDownList(['active' => 'Active', 'inactive' => 'Inactive'], ['prompt' => 'Status']); ?> <div class="form-group">
use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; use backend\models\Companies; /* @var $this yii\web\View */ /* @var $model backend\models\Branches */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="branches-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'company_id')->dropDownList(ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name')); ?> <?php echo $form->field($model, 'branch_name')->textInput(['maxlength' => 100]); ?> <?php echo $form->field($model, 'branch_address')->textInput(['maxlength' => 100]); ?> <?php echo $form->field($model, 'branch_status')->dropDownList(['active' => 'Active', 'inactive' => 'Inactive', '' => ''], ['prompt' => '']); ?> <div class="form-group">