Beispiel #1
0
 /**
  * Executes the job.
  *
  * @return bool
  */
 public function handle()
 {
     $this->status->user_id = auth()->id();
     $this->status->name = $this->request->input('name');
     $this->status->color = $this->request->input('color');
     return $this->status->save();
 }
Beispiel #2
0
 public function actionCreate()
 {
     $model = new Status();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         return $this->render('view', ['model' => $model]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 public function actionCreate()
 {
     $model = new Status();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         // valid data received in $model
         return $this->render('view', ['model' => $model]);
     } else {
         // either the page is initially displayed or there is some validation error
         return $this->render('create', ['model' => $model]);
     }
 }
 public function all($params)
 {
     $params['order'] = isset($params['order']) ? $params['order'] : ['id|ASC'];
     $statuses = Status::select("statuses.*");
     $statuses = parent::execute($statuses, $params);
     return $statuses;
 }
 /**
  * Returns a new form of the specified work order report.
  *
  * @param WorkOrder       $workOrder
  * @param WorkOrderReport $report
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function form(WorkOrder $workOrder, WorkOrderReport $report)
 {
     return $this->form->of('work-orders.report', function (FormGrid $form) use($workOrder, $report) {
         if ($report->exists) {
             $method = 'PATCH';
             $url = route('maintenance.work-orders.report.update', [$workOrder->getKey(), $report->getKey()]);
             $form->submit = 'Save';
         } else {
             $method = 'POST';
             $url = route('maintenance.work-orders.report.store', [$workOrder->getKey()]);
             $form->submit = 'Create';
         }
         $form->attributes(compact('method', 'url'));
         $form->with($report);
         $form->fieldset(function (Fieldset $fieldset) use($workOrder) {
             $fieldset->control('select', 'status')->options(function () {
                 $statuses = Status::all()->pluck('name', 'id');
                 $statuses[0] = 'None';
                 return $statuses;
             })->value(function () use($workOrder) {
                 if ($workOrder->status instanceof Status) {
                     return $workOrder->status->getKey();
                 }
             })->attributes(['class' => 'select2']);
             $fieldset->control('input:textarea', 'description');
         });
     });
 }
 public function run()
 {
     DB::table('statuses')->delete();
     $collection = [['status' => 'Tier One'], ['status' => 'Tier Two'], ['status' => 'Tier Three'], ['status' => 'Tier Four'], ['status' => 'Pending'], ['status' => 'Completed'], ['status' => 'Closed'], ['status' => 'Suspended']];
     foreach ($collection as $record) {
         Status::create($record);
     }
 }
 /**
  * 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');
 }
Beispiel #8
0
 public function index()
 {
     if (Auth::check()) {
         $statuses = Status::notReply()->where(function ($query) {
             return $query->where('user_id', Auth::user()->id)->orWhereIn('user_id', Auth::user()->friends()->lists('id'));
         })->orderBy('created_at', 'desc')->paginate(10);
         return view('timeline.index')->with('statuses', $statuses);
     }
     return view('home');
 }
 /**
  * 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;
 }
Beispiel #10
0
 /**
  * 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;
 }
Beispiel #11
0
 /**
  * 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]);
     }
 }
 public function getformAction()
 {
     if (!$this->isXmlHttpRequest()) {
         throw new \Exception('Неверный тип запроса!');
     }
     $project = false;
     if (!is_null($this->request->getPost('id'))) {
         $id = (int) $this->request->getPost('id');
         $projectsModel = new Projects();
         $project = $projectsModel->getProjectsDataForEdit($id);
         $usersModel = new Users();
         $usersModel->setWhere('`roles_id` IN(1,2)');
         $this->view->initiators = $usersModel->select();
         $usersModel->setWhere('`roles_id` IN(1,3)');
         $this->view->executors = $usersModel->select();
         $executorsModel = new Executors();
         $this->view->selectedExecutors = $executorsModel->getExecutorsAsArrayByProject($id);
         $statusModel = new Status();
         $this->view->statuses = $statusModel->select();
     }
     $this->view->project = $project;
 }
 public function show($id)
 {
     if (Auth::user()->can('read-ticket')) {
         $data['ticket'] = self::API()->find(['id' => $id]);
         if ($data['ticket']) {
             $data['title'] = "Ticket #" . $data['ticket']->id;
             $data['menu_actions'] = [Form::editItem(route('tickets.edit', $id), "Edit This Ticket", Auth::user()->can('update-ticket'))];
             $data['ticket']['posts'] = PostsController::API()->all(['where' => ['ticket_id|=|' . $id], "order" => ['posts.created_at|ASC'], "paginate" => "false"]);
             $data['ticket']['history'] = TicketHistory::where('ticket_id', '=', $id)->orderBy('created_at')->get();
             $data['statuses'] = Status::where('id', TICKET_WFF_STATUS_ID)->orWhere('id', TICKET_SOLVED_STATUS_ID)->get();
             $data['draft_post'] = Post::where("ticket_id", $id)->where("status_id", POST_DRAFT_STATUS_ID)->where("author_id", Auth::user()->active_contact->id)->first();
             $data['important_post'] = null;
             if (in_array($data['ticket']->status_id, [TICKET_SOLVED_STATUS_ID, TICKET_WFF_STATUS_ID])) {
                 foreach ($data['ticket']['posts']->reverse() as $post) {
                     if ($post->ticket_status_id != $data['ticket']->status_id) {
                         break;
                     } else {
                         $data['important_post'] = $post;
                     }
                 }
             }
             $links = [];
             $temp = TicketLink::where("ticket_id", "=", $id)->get();
             foreach ($temp as $elem) {
                 $links[] = $elem->linked_ticket_id;
             }
             $data['ticket']['links'] = self::API()->all(['where' => ['tickets.id|IN|' . implode(":", $links)]]);
             $linked_to = [];
             $temp = TicketLink::where("linked_ticket_id", "=", $id)->get();
             foreach ($temp as $elem) {
                 $linked_to[] = $elem->ticket_id;
             }
             $data['ticket']['linked_to'] = self::API()->all(['where' => ['tickets.id|IN|' . implode(":", $linked_to)]]);
             if (isset($data['important_post'])) {
                 switch ($data['ticket']->status_id) {
                     case TICKET_WFF_STATUS_ID:
                         $data['important_post']->alert_type = "danger";
                         break;
                     case TICKET_SOLVED_STATUS_ID:
                         $data['important_post']->alert_type = "success";
                         break;
                 }
             }
             return view('tickets/show', $data);
         } else {
             return redirect()->back()->withErrors(['404 The following Ticket coudn\'t be found']);
         }
     } else {
         return redirect()->back()->withErrors(['Access denied to tickets show page']);
     }
 }
 public function postReply(Request $request, $statusId)
 {
     $this->validate($request, ["reply-{$statusId}" => 'required|max:1000'], ['required' => 'The reply body is required.']);
     $status = Status::notReply()->find($statusId);
     if (!$status) {
         return redirect()->route('home');
     }
     if (!Auth::user()->isFriendsWith($status->user) && Auth::user()->id !== $status->user->id) {
         return redirect()->route('home');
     }
     $reply = Status::create(['body' => $request->input("reply-{$statusId}")])->user()->associate(Auth::user());
     $status->replies()->save($reply);
     return redirect()->back();
 }
Beispiel #15
0
 /**
  * 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;
 }
Beispiel #16
0
 /**
  * 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;
 }
Beispiel #17
0
 /**
  * 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;
 }
 /**
  * Returns a new form of the specified status.
  *
  * @param Status $status
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function form(Status $status)
 {
     return $this->form->of('work-orders.statuses', function (FormGrid $form) use($status) {
         if ($status->exists) {
             $method = 'PATCH';
             $url = route('maintenance.work-orders.statuses.update', [$status->getKey()]);
             $form->submit = 'Save';
         } else {
             $method = 'POST';
             $url = route('maintenance.work-orders.statuses.store', [$status->getKey()]);
             $form->submit = 'Create';
         }
         $colors = config('maintenance.colors', []);
         $form->with($status);
         $form->attributes(compact('method', 'url'));
         $form->fieldset(function (Fieldset $fieldset) use($colors) {
             $fieldset->control('input:text', 'name')->attributes(['placeholder' => 'ex. Awaiting Parts / Supplies']);
             $fieldset->control('select', 'color')->options($colors)->value(function (Status $status) {
                 return $status->color;
             })->attributes(['class' => 'select2-color']);
         });
     });
 }
Beispiel #19
0
 /**
  * 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;
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Region $region, TrainRoad $trainRoad, Stantion $stantion)
 {
     $regionsCount = $region->count();
     $tRoadsCount = $trainRoad->count();
     $stationsCount = $stantion->count();
     $condCount = Condition::count();
     $productsCount = Product::count();
     $servicesCount = Service::count();
     $catCount = Category::count();
     $statusesCount = Status::count();
     $serviceStatusesCount = ServiceStatus::count();
     $newOrdersCount = Order::where('is_new', 1)->count();
     $newServiceOrdersCount = ServiceOrder::where('is_new', 1)->count();
     $customers = Firm::where('accountant_fio', null)->get();
     return view('admin.adminArea', ['regionsCount' => $regionsCount, 'tRoadsCount' => $tRoadsCount, 'stationsCount' => $stationsCount, 'condCount' => $condCount, 'catCount' => $catCount, 'productsCount' => $productsCount, 'servicesCount' => $servicesCount, 'statusesCount' => $statusesCount, 'newOrdersCount' => $newOrdersCount, 'serviceStatusesCount' => $serviceStatusesCount, 'newServiceOrdersCount' => $newServiceOrdersCount, 'customers' => $customers]);
 }
Beispiel #21
0
 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();
 }
 /**
  * Execute the job.
  *
  * @return bool
  */
 public function handle()
 {
     // We'll make sure the work request doesn't already have a
     // work order attached to it before we try and create it.
     if (!$this->workRequest->hasWorkOrder()) {
         $priority = Priority::findOrCreateRequested();
         $status = Status::findOrCreateRequested();
         $workOrder = new WorkOrder();
         $workOrder->status_id = $status->getKey();
         $workOrder->priority_id = $priority->getKey();
         $workOrder->request_id = $this->workRequest->getKey();
         $workOrder->user_id = $this->workRequest->user_id;
         $workOrder->subject = $this->workRequest->subject;
         $workOrder->description = $this->workRequest->description;
         if ($workOrder->save()) {
             return $workOrder;
         }
     }
     return false;
 }
Beispiel #23
0
    

    <?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']);
Beispiel #24
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStatus()
 {
     return $this->hasOne(Status::className(), ['id' => 'status_id']);
 }
Beispiel #25
0
 /**
  * Finds the Status model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Status the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Status::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #26
0
?>

    <?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();
?>
 public function indexInsertPreson1()
 {
     $status = Status::all();
     return View('/insert_preson1')->with('status', $status);
 }
 /**
  * Returns a new form for work orders.
  *
  * @param WorkOrder $workOrder
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function form(WorkOrder $workOrder)
 {
     return $this->form->of('work-orders', function (FormGrid $form) use($workOrder) {
         if ($workOrder->exists) {
             $method = 'PATCH';
             $url = route('maintenance.work-orders.update', [$workOrder->getKey()]);
             $form->submit = 'Save';
         } else {
             $method = 'POST';
             $url = route('maintenance.work-orders.store');
             $form->submit = 'Create';
         }
         $form->with($workOrder);
         $form->attributes(compact('method', 'url'));
         $form->fieldset(function (Fieldset $fieldset) {
             $fieldset->control('select', 'category')->value(function (WorkOrder $workOrder) {
                 return $workOrder->category_id;
             })->options(function () {
                 return Category::getSelectHierarchy('work-orders');
             });
             $fieldset->control('select', 'location')->value(function (WorkOrder $workOrder) {
                 return $workOrder->location_id;
             })->options(function () {
                 return Location::getSelectHierarchy();
             });
             $fieldset->control('select', 'status')->options(function () {
                 $statuses = Status::all()->pluck('name', 'id');
                 $statuses[0] = 'None';
                 return $statuses;
             });
             $fieldset->control('select', 'priority')->value(function (WorkOrder $workOrder) {
                 return $workOrder->priority_id;
             })->options(function () {
                 $priorities = Priority::all()->pluck('name', 'id');
                 $priorities[0] = 'None';
                 return $priorities;
             });
             $fieldset->control('select', 'assets[]')->label('Assets')->options(function () {
                 return Asset::all()->pluck('name', 'id');
             })->attributes(['class' => 'select2', 'multiple' => true]);
             $fieldset->control('input:text', 'subject')->attributes(['placeholder' => 'ex. Worked on HVAC']);
             $fieldset->control('input:textarea', 'description');
         });
     });
 }
Beispiel #29
0
$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>
Beispiel #30
0
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>