/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Branches::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->joinWith('companiesCompany');
     $query->andFilterWhere(['branch_id' => $this->branch_id, 'branch_created_date' => $this->branch_created_date]);
     $query->andFilterWhere(['like', 'branch_name', $this->branch_name])->andFilterWhere(['like', 'branch_address', $this->branch_address])->andFilterWhere(['like', 'branch_status', $this->branch_status])->andFilterWhere(['like', 'companies.company_name', $this->companies_company_id]);
     return $dataProvider;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBranchesBranch()
 {
     return $this->hasOne(Branches::className(), ['branch_id' => 'branches_branch_id']);
 }
Exemple #3
0
/* @var $model app\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' => 'Select a company..']);
?>

    <?php 
echo $form->field($model, 'branches_branch_id')->dropDownList(ArrayHelper::map(Branches::find()->all(), 'branch_id', 'branch_name'), ['prompt' => 'Select a branch..']);
?>

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

    

    <?php 
echo $form->field($model, 'department_status')->dropDownList(['active' => 'Active', 'inactive' => 'Inactive', '' => ''], ['prompt' => '']);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBranches()
 {
     return $this->hasMany(Branches::className(), ['companies_company_id' => 'company_id']);
 }
 /**
  * Finds the Branches model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Branches the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Branches::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #6
0
 public function getBranchesTo()
 {
     return $this->hasOne(Branches::className(), ['id' => 'to_id']);
 }
Exemple #7
0
                }
            }
        } else {
            $ar = $data;
        }
        ?>

                    <P>
                    <?php 
        foreach ($ar as $k => $val) {
            ?>
                        <?php 
            echo $k == 'from_id' ? "<br />Откуда:" . Branches::branchesArray()[$val] : '';
            ?>
                        <?php 
            echo $k == 'to_id' ? "<br />Куда:" . Branches::branchesArray()[$val] : '';
            ?>
                        <?php 
            echo $k == 'ship_date' ? "<br />Дата отправки:{$val}" : '';
            ?>
                        <?php 
            echo $k == 'create_at' ? "" : '';
            ?>
                        <?php 
            echo $k == 'update_at' ? "" : '';
            ?>
                        <?php 
            echo $k == 'author_id' ? "" : '';
            ?>
                        <?php 
            echo $k == 'comment' ? "<br />Комментарий:{$val}" : '';
Exemple #8
0
    <?php 
echo Html::a('Отчет', ['/transfers/report'], ['class' => 'btn btn-warning']);
?>
    <?php 
Pjax::begin(['id' => 'transfers-pjax']);
?>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'formatter' => ['class' => 'yii\\i18n\\Formatter', 'nullDisplay' => ''], 'tableOptions' => ['class' => 'table table-bordered table-hover'], 'rowOptions' => function ($model, $index, $widget, $grid) {
    return $model->mark_delete ? ['class' => 'marked-delete'] : "";
}, 'columns' => [['attribute' => ' ', 'value' => function ($data) {
    $c = $data->comment ? 'K' : '';
    $e = $data->express ? '<i class = "glyphicon glyphicon-plane"></i>' : '';
    $m = $data->moved ? '<i class = "glyphicon glyphicon-arrow-right"></i>' . "({$data->moved_count})" : '';
    return $c . $e . $m;
}, 'format' => 'html'], ['attribute' => 'number'], ['attribute' => 'declaration'], ['attribute' => 'from_id', 'value' => 'branchesFrom.name', 'filter' => \app\models\Branches::branchesArray()], ['attribute' => 'to_id', 'value' => 'branchesTo.name', 'filter' => \app\models\Branches::branchesArray()], ['attribute' => 'ship_date', 'filter' => \yii\jui\DatePicker::widget(['model' => $searchModel, 'attribute' => 'ship_date'])], ['attribute' => 'Склад', 'value' => function ($data) {
    $b = $data->warehouse_big > 0 ? 'Б' : '';
    $s = $data->warehouse_small > 0 ? 'М' : '';
    return $b . ' ' . $s;
}], ['attribute' => 'status', 'value' => function ($data) {
    return Transfers::statusArray()[$data->status];
}, 'filter' => Transfers::statusArray()], ['attribute' => 'author_id', 'value' => 'user.full_name'], ['attribute' => 'Создано / Отредактировано ', 'value' => function ($data) {
    return $data->created_at . '<br />' . $data->updated_at;
}, 'format' => 'raw', 'contentOptions' => ['style' => 'font-size:12px']], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}{mark-delete}{delete}', 'buttons' => ['mark-delete' => function ($url) {
    return Html::a('<i class=" glyphicon glyphicon-remove-sign"></i>', $url, ['title' => 'Пометить на удаление', 'data-method' => 'post']);
}]]]]);
Pjax::end();
?>
    <div>
        <b>К</b> - Комментарий
        <i class = "glyphicon glyphicon-plane"></i> - Срочный
 public function deleteBranch($id)
 {
     $data = Branches::deleteBranch($id);
     return response()->json($data);
 }
Exemple #10
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBranches()
 {
     return $this->hasMany(Branches::className(), ['bankID' => 'id']);
 }