/** * Displays a single Status model. * @param string $slug * @return mixed */ public function actionSlug($slug) { $model = Status::find()->where(['slug' => $slug])->one(); if (!is_null($model)) { return $this->render('view', ['model' => $model]); } else { return $this->redirect('/status/index'); } }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $this->validation_rules($request); $statusUpdate = $request->input(); $status = Status::find($id); $status->update($statusUpdate); Session::flash('flash_message', 'Data status layanan berhasil diupdate!'); return redirect('admin/status'); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Status::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'permissions' => $this->permissions, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'message', $this->message]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Status::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'status', $this->status]); return $dataProvider; }
/** * Creates a new Word model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $projekt = Projekt::find()->all(); $status = Status::find()->all(); $words_group = WordsGroup::find()->all(); $model = new Word(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model, 'projekt' => $projekt, 'status' => $status, 'words_group' => $words_group]); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Status::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]], 'pagination' => ['pageSize' => 100]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'color', $this->color]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Status::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'created_id' => $this->created_id, 'updated_at' => $this->updated_at, 'updated_id' => $this->updated_id, 'weight' => $this->weight]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Status::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(['id' => $this->id]); $query->andFilterWhere(['like', 'descripcion_status', $this->descripcion_status]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Status::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 6]]); $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(['id' => $this->id, 'permissions' => $this->permissions, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'created_by' => $this->created_by]); $query->andFilterWhere(['like', 'message', $this->message]); return $dataProvider; }
public function getLike($statusId) { $status = Status::find($statusId); if (!$status) { return redirect()->route('home'); } if (!Auth::user()->isFriendsWith($status->user)) { return redirect()->route('home'); } if (Auth::user()->hasLikedStatus($status)) { return redirect()->back(); } $like = $status->likes()->create([]); Auth::user()->likes()->save($like); return redirect()->back(); }
<?php echo $form->field($model, 'date_input')->textInput(); ?> <?php echo $form->field($model, 'last_update')->textInput(); ?> <?php echo $form->field($model, 'last_staff')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'risk_status')->widget(Select2::classname(), ['data' => ArrayHelper::map(Status::find()->all(), 'STATUS_ID', 'STATUS_NAME'), 'options' => ['placeholder' => 'เลือกสถานะของรายการ ...'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> <div class="form-group field-upload_files"> <label class="control-label" for="upload_files[]"> ภาพถ่าย </label> <div> <?php echo FileInput::widget(['name' => 'upload_ajax[]', 'options' => ['multiple' => true, 'accept' => 'image/*'], 'pluginOptions' => ['overwriteInitial' => false, 'initialPreviewShowDelete' => true, 'initialPreview' => $initialPreview, 'initialPreviewConfig' => $initialPreviewConfig, 'uploadUrl' => Url::to(['/priskhead/upload-ajax']), 'uploadExtraData' => ['ref' => $model->ref], 'maxFileCount' => 100]]); ?> </div> </div> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => ($model->isNewRecord ? 'btn btn-success' : 'btn btn-primary') . ' btn-lg btn-block']);
use yii\helpers\ArrayHelper; use app\models\Series; use app\models\Status; /* @var $this yii\web\View */ /* @var $searchModel app\models\CardSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('app', 'Cards'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="card-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 Card'), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'seriesId', 'value' => 'series.seriesName', 'filter' => Html::activeDropDownList($searchModel, 'seriesId', ArrayHelper::map(Series::find()->asArray()->all(), 'id', 'seriesName'), ['class' => 'form-control', 'prompt' => 'Выбрать серию'])], 'number', 'issueDateTime', 'endingDateTime', 'lastDateOfUse', 'currentSumm', ['attribute' => 'statusId', 'value' => 'status.statusName', 'filter' => Html::activeDropDownList($searchModel, 'statusId', ArrayHelper::map(Status::find()->asArray()->all(), 'id', 'statusName'), ['class' => 'form-control', 'prompt' => 'Выбрать статус'])]]]); ?> </div>
?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'description')->widget(Widget::className(), ['settings' => ['lang' => 'ru', 'minHeight' => 200, 'plugins' => ['clips', 'fullscreen']]]); ?> <?php echo $form->field($model, 'weight')->textInput(); ?> <?php $listdata = ArrayHelper::map(Status::find()->all(), 'id', 'title'); ?> <?php echo $form->field($model, 'status_id')->dropDownList($listdata, ['class' => 'form-control select']); ?> <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(); ?>
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $status = Status::find($id); $status->delete(); return back()->with('alert-success', 'Статус ' . $status->status . ' удален'); }
$form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'description')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'end_date')->widget(DatePicker::className(), ['inline' => false, 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]); ?> <?php echo $form->field($model, 'status_id')->dropDownList(\yii\helpers\ArrayHelper::map(\app\models\Status::find()->all(), 'id', 'name'), ['prompt' => 'Select status']); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
/** * Updates an existing Order model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $status = ArrayHelper::map(Status::find()->all(), 'status_id', 'status'); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->order_id]); } else { return $this->render('update', ['model' => $model, 'status' => $status]); } }
echo $form->field($model, 'issueDateTime')->widget(DatePicker::className(), ['inline' => true, 'template' => '<div class="well well-sm" style="background-color: #fff; width:250px">{input}</div>', 'clientOptions' => ['autoclose' => true, 'format' => 'dd-M-yyyy']]); ?> <?php echo $form->field($model, 'endingDateTime')->widget(DatePicker::className(), ['inline' => true, 'template' => '<div class="well well-sm" style="background-color: #fff; width:250px">{input}</div>', 'clientOptions' => ['autoclose' => true, 'format' => 'dd-M-yyyy']]); ?> <?php echo $form->field($model, 'lastDateOfUse')->widget(DatePicker::className(), ['inline' => true, 'template' => '<div class="well well-sm" style="background-color: #fff; width:250px">{input}</div>', 'clientOptions' => ['autoclose' => true, 'format' => 'dd-M-yyyy']]); ?> <?php echo $form->field($model, 'currentSumm')->textInput(); ?> <?php echo $form->field($model, 'statusId')->dropDownList(ArrayHelper::map(Status::find()->asArray()->all(), 'id', 'statusName')); ?> <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(); ?> </div>
public function actionIndex() { $model = new Status(); $model->find(); //return $this->render('create', array('model' => $model, 'app' => Yii::$app ) ); }
/** * Lists all Status models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Status::find()]); return $this->render('index', ['dataProvider' => $dataProvider]); }
public function changeStatus($statusId, $orderId, $is_service = 0) { $response = 0; try { DB::transaction(function () use($statusId, $orderId, &$response, $is_service) { $messageData = []; $email = ''; if ($is_service) { $order = ServiceOrder::with('user', 'service_status')->where('id', $orderId)->first(); $messageData['status_was'] = $order->service_status->status; $order->service_status_id = $statusId; $order->save(); $response = 1; $email = $order->user->email; $messageData['user'] = $order->user->name; $messageData['type'] = 'прочие услуги'; $messageData['order_number'] = $order->id; $messageData['status_now'] = ServiceStatus::find($statusId)->status; } else { if ($statusId == Order::CANCELED) { $order = Order::with('products_in_order.price', 'user', 'status')->where('id', $orderId)->first(); foreach ($order->products_in_order as $product) { $product->price->amount += $product->product_amount; $product->price->save(); } // $response = Order::CANCELED; } else { $order = Order::with('user', 'status')->where('id', $orderId)->first(); // if($statusId == Order::COMPLETED) { // $response = Order::COMPLETED; // } else { // $response = 1; // } } $messageData['status_was'] = $order->status->status; $order->status_id = $statusId; $order->save(); $response = 1; $email = $order->user->email; $messageData['user'] = $order->user->name; $messageData['type'] = 'запчасти грузовых вагонов'; $messageData['order_number'] = $order->id; $messageData['status_now'] = Status::find($statusId)->status; } Mail::send('emails.statusDone', $messageData, function ($message) use($email) { $message->to($email)->subject('Смена статуса заказа'); }); }); } catch (Exception $e) { $response = 0; } // dd($response); echo $response; }
</div> </div> <div class="row"> <div class="col-md-4"> <?php echo $form->field($model, 'typeperson_id')->dropDownList(ArrayHelper::map(Typeperson::find()->orderBy("name ASC")->all(), 'id', 'name'), ['prompt' => 'Todos']); ?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'typesolicitation_id')->dropDownList(ArrayHelper::map(Typesolicitation::find()->orderBy("name ASC")->all(), 'id', 'name'), ['prompt' => 'Todos']); ?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'status_id')->dropDownList(ArrayHelper::map(Status::find()->orderBy("name ASC")->all(), 'id', 'name'), ['prompt' => 'Todos']); ?> </div> </div> <?php // echo $form->field($model, 'location_id') ?> <?php // echo $form->field($model, 'status_id') ?> <?php // echo $form->field($model, 'typeperson_id') ?>
/* @var $this yii\web\View */ /* @var $searchModel app\models\ReportSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ ?> <div class="row"> <h2>Personalizado</h2> <hr/> <div class="col-xs-6 col-md-3"> <?php echo $this->render('_menu'); ?> </div> <div class="col-xs-12 col-sm-6 col-md-9"> <?php echo $this->render('_search', ['model' => $searchModel]); ?> <hr/> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'tableOptions' => ['class' => 'table table-condensed'], 'emptyText' => '</br><p class="text-danger">Nenhuma solicitação encontrada!</p>', 'summary' => "<p class=\"text-primary \">Quantidade de solicitações encontradas: <span class=\"badge\">{totalCount}</span></p><hr/>", 'columns' => [['attribute' => 'id', 'enableSorting' => true, 'contentOptions' => ['style' => 'width: 5%;text-align:left']], ['attribute' => 'created', 'enableSorting' => true, 'contentOptions' => ['style' => 'width: 4%;text-align:center'], 'format' => ['date', 'php:d/m/Y']], ['attribute' => 'user_id', 'enableSorting' => true, 'value' => function ($model) { return $model->user->username; }, 'filter' => ArrayHelper::map(User::find()->orderBy('username')->asArray()->all(), 'id', 'username'), 'contentOptions' => ['style' => 'width: 14%;text-align:center']], ['attribute' => 'status_id', 'format' => 'raw', 'enableSorting' => true, 'value' => function ($model) { return '<span style="color:' . $model->status->color . '"><i class="fa fa-circle"></i> ' . $model->status->name . '</span>'; }, 'filter' => ArrayHelper::map(Status::find()->orderBy('name')->asArray()->all(), 'id', 'name'), 'contentOptions' => ['style' => 'width: 14%;text-align:left']], ['attribute' => 'analyst_id', 'format' => 'raw', 'enableSorting' => true, 'value' => function ($model) { return $model->analyst ? $model->analyst->username : '******'; }, 'contentOptions' => ['style' => 'width: 8%;text-align:left']]]]); ?> </div> </div>