Example #1
0
 public function getStatesnext()
 {
     return $this->hasMany(\app\models\StatesNext::className(), ['STATE_ID' => 'ID'])->where(['DEL_TRACT_ID' => 0]);
 }
Example #2
0
 public function actionSetstatenext()
 {
     if (Yii::$app->request->isAjax) {
         $this_value = $_POST['this_value'];
         $parent_value = $_POST['parent_value'];
         $status = $_POST['status'];
         $transactions = \app\models\Transactions::find()->where(['TN' => \Yii::$app->user->id])->orderBy('ID DESC')->one();
         if ($status == 'checked') {
             $next_state = new \app\models\StatesNext();
             $next_state->STATE_ID = $parent_value;
             $next_state->NEXT_STATE_ID = $this_value;
             $next_state->TRACT_ID = $transactions->ID;
             if ($next_state->save()) {
                 Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
                 return ['error' => 0];
             } else {
                 Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
                 return ['error' => 1];
             }
         } else {
             //update DEL_TRACT_ID for old value
             $next_state_old = \app\models\StatesNext::find()->where(['STATE_ID' => $parent_value, 'NEXT_STATE_ID' => $this_value])->one();
             $next_state_old->DEL_TRACT_ID = $transactions->ID;
             if ($next_state_old->save()) {
                 Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
                 return ['error' => 0];
             } else {
                 Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
                 return ['error' => 1];
             }
         }
     }
 }
echo $form->field($model, 'agreed_podr_list', ['template' => "{label}<div class=\"col-sm-6\">{input}</div><div class=\"col-sm-2\" style=\"text-align: right;\"><button type=\"button\" id=\"add-agreed-podr-button-update\" class=\"btn btn-default btn-sm\"><span class=\"glyphicon glyphicon-plus\"></span></button></div>\n{hint}", 'labelOptions' => ['class' => 'col-sm-4 control-label'], 'inputOptions' => ['class' => 'form-control input-sm']])->textInput();
?>
				    <div class="hr-line-dashed"></div>

				    <?php 
echo $form->field($model, 'transmitted_podr_list', ['template' => "{label}<div class=\"col-sm-6\">{input}</div><div class=\"col-sm-2\" style=\"text-align: right;\"><button type=\"button\" id=\"add-transmitted-podr-button-update\" class=\"btn btn-default btn-sm\"><span class=\"glyphicon glyphicon-plus\"></span></button></div>\n{hint}", 'labelOptions' => ['class' => 'col-sm-4 control-label'], 'inputOptions' => ['class' => 'form-control input-sm']])->textInput();
?>
				    <div class="hr-line-dashed"></div>

				    <?php 
$this->registerJs('function format(state) {return state.text;}', View::POS_HEAD);
$this->registerJs('function format_selection(state) {return "<b>"+state.text+"</b>";}', View::POS_HEAD);
?>
				    <?php 
if ($show_states == 1) {
    $states_list = yii\helpers\ArrayHelper::map(\app\models\StatesNext::find()->where(['STATE_ID' => $model->state, 'DEL_TRACT_ID' => 0])->orderBy('ID ASC')->all(), 'NEXT_STATE_ID', 'state_name_state_colour');
    $current_status = \app\models\States::findOne($model->state)->getState_name_state_colour();
    $states_list = [$model->state => $current_status] + $states_list;
    ?>
				    <?php 
    echo $form->field($model, 'state', ['template' => "{label}<div class=\"col-sm-8\">{input}</div>\n{hint}", 'labelOptions' => ['class' => 'col-sm-4 control-label'], 'inputOptions' => ['class' => 'form-control input-sm']])->widget(\kartik\select2\Select2::classname(), ['options' => ['placeholder' => ''], 'hideSearch' => true, 'data' => $states_list, 'pluginOptions' => ['allowClear' => true, 'templateResult' => new JsExpression('format'), 'escapeMarkup' => new JsExpression("function(m) { return m; }"), 'templateSelection' => new JsExpression('format_selection')]]);
}
?>

</div>
<div class="modal-footer">
	<?php 
if (!$not_ajax) {
    ?>
	<button type="button" class="btn btn-default" id="issue-cancel-update-button">Отмена</button>
	<?php 
Example #4
0
        ?>
										</a>
									</h4>
								</div>
								<div id="collapse-state-item-<?php 
        echo $state->ID;
        ?>
" class="panel-collapse collapse" role="tabpanel" aria-labelledby="state-list-item-<?php 
        echo $state->ID;
        ?>
">
									<div class="panel-body">
										<?php 
        $inner_states = \app\models\States::find()->where(['!=', 'ID', $state->ID])->all();
        foreach ($inner_states as $inner_state) {
            $state_next = \app\models\StatesNext::find()->where(['STATE_ID' => $state->ID, 'NEXT_STATE_ID' => $inner_state->ID, 'DEL_TRACT_ID' => 0])->one();
            //if($state_next) echo $state_next->NEXT_STATE_ID;
            ?>
											<div class="checkbox" style="font-size: 11px;"><label><input <?php 
            if ($perm_level != 2) {
                ?>
disabled<?php 
            }
            ?>
 type="checkbox" <?php 
            if ($state_next) {
                ?>
checked<?php 
            }
            ?>
 class="states-change-checkbox" data-parent="<?php