public function actionCreate()
 {
     $model = new Staffer();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $module = $this->module;
         return $this->redirect(['update', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model, 'module' => $this->module]);
     }
 }
示例#2
0
 public function search($params)
 {
     $query = Staffer::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => new \yii\data\Sort(['attributes' => ['name', 'status', 'id']])]);
     $dataProvider->sort = ['defaultOrder' => ['id' => SORT_DESC]];
     $this->load($params);
     if (!$this->validate()) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'category_id' => $this->category_id, 'organization_id' => $this->organization_id, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'text', $this->text]);
     return $dataProvider;
 }
示例#3
0
 public function getStaffers()
 {
     return $this->hasMany(Staffer::className(), ['category_id' => 'id'])->available();
 }
示例#4
0
 public function getWorker()
 {
     return $this->hasOne(Staffer::className(), ['id' => 'worker_id']);
 }
示例#5
0
<div class="fine-form">

    <div class="row">
        <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>

        <input type="hidden" name="backUrl" value="<?php 
echo Html::encode(yii::$app->request->referrer);
?>
" />
        
        <div class="col-md-6">
            <?php 
echo $form->field($model, 'staffer_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Staffer::find()->all(), 'id', 'name'), 'language' => 'ru', 'options' => ['placeholder' => 'Выберите сотрудника ...'], 'pluginOptions' => ['allowClear' => true]]);
?>

            <?php 
echo $form->field($model, 'reason')->widget(Select2::classname(), ['data' => $module->fineReasons, 'language' => 'ru', 'options' => ['placeholder' => 'Выберите причину ...'], 'pluginOptions' => ['allowClear' => true]]);
?>
        </div>
        <div class="col-md-6">
            <?php 
echo $form->field($model, 'sum')->textInput();
?>

            <?php 
echo $form->field($model, 'comment')->textArea();
?>
        </div>
示例#6
0
        </div>
        <div class="col-md-10">
            <?php 
echo $this->render('../parts/menu');
?>
        </div>
    </div>
    
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">Новый штраф</h3>
        </div>
        <div class="panel-body">
            <div class="col-md-6">
                <?php 
echo $this->render('_form', ['model' => $model, 'module' => $module]);
?>
            </div>
        </div>
    </div>

    <br style="clear: both;"></div>

    <?php 
echo \kartik\grid\GridView::widget(['export' => false, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'id', 'filter' => false, 'options' => ['style' => 'width: 55px;']], ['attribute' => 'reason', 'filter' => $module->fineReasons, 'content' => function ($model) use($module) {
    return $module->fineReasons[$model->reason];
}], 'sum', 'created_at', 'comment', ['attribute' => 'staffer_id', 'filter' => Html::activeDropDownList($searchModel, 'staffer_id', ArrayHelper::map(Staffer::find()->all(), 'id', 'name'), ['class' => 'form-control', 'prompt' => 'Сотрудник']), 'value' => 'staffer.name'], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}', 'buttonOptions' => ['class' => 'btn btn-default'], 'options' => ['style' => 'width: 125px;']]]]);
?>

</div>
示例#7
0
 public function init()
 {
     $this->finder = StafferModel::find();
     parent::init();
 }
示例#8
0
        ?>
                    </td>
                    <td>
                        <!-- к выплате -->
                        <?php 
        echo $model->salary - $payed;
        ?>
                        <?php 
        // echo $sessionStatistic['salary'][$model->user_id]['salary'] - $payed;
        ?>
                    </td>
                    <td>
                        <!-- кнопка выплатить -->
                        <?php 
        if ($model->salary - $payed > 0) {
            echo \pistol88\staffer\widgets\AddPayment::widget(['staffer' => Staffer::findOne($model->worker_id), 'paymentSum' => $model->salary - $payed, 'sessionId' => $model->session->id]);
        }
        ?>
                    </td>
                </tr>
            <?php 
    }
    ?>
         <?php 
}
?>
        <tr>

        </tr>
    </table>