Commit e9013fc3b19c6b4d795b3182c3990620cc13dda0
1 parent
f25acc4a
test
Showing
12 changed files
with
575 additions
and
21 deletions
Show diff stats
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace common\models; | ||
| 4 | + | ||
| 5 | +use Yii; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * This is the model class for table "job". | ||
| 9 | + * | ||
| 10 | + * @property integer $job_id | ||
| 11 | + * @property string $name | ||
| 12 | + * @property string $link | ||
| 13 | + * @property string $date_start | ||
| 14 | + * @property string $date_end | ||
| 15 | + * @property string $position | ||
| 16 | + * @property integer $user_id | ||
| 17 | + * @property integer $total_count | ||
| 18 | + * @property integer $complete_count | ||
| 19 | + * @property integer $current | ||
| 20 | + */ | ||
| 21 | +class Job extends \yii\db\ActiveRecord | ||
| 22 | +{ | ||
| 23 | + /** | ||
| 24 | + * @inheritdoc | ||
| 25 | + */ | ||
| 26 | + public static function tableName() | ||
| 27 | + { | ||
| 28 | + return 'job'; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * @inheritdoc | ||
| 33 | + */ | ||
| 34 | + public function rules() | ||
| 35 | + { | ||
| 36 | + return [ | ||
| 37 | + [['name'], 'required'], | ||
| 38 | + [['date_start', 'date_end'], 'safe'], | ||
| 39 | + [['user_id', 'total_count', 'complete_count', 'current'], 'integer'], | ||
| 40 | + [['name', 'link', 'position'], 'string', 'max' => 255] | ||
| 41 | + ]; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * @inheritdoc | ||
| 46 | + */ | ||
| 47 | + public function attributeLabels() | ||
| 48 | + { | ||
| 49 | + return [ | ||
| 50 | + 'job_id' => Yii::t('app', 'Job ID'), | ||
| 51 | + 'name' => Yii::t('app', 'Name'), | ||
| 52 | + 'link' => Yii::t('app', 'Link'), | ||
| 53 | + 'date_start' => Yii::t('app', 'Date Start'), | ||
| 54 | + 'date_end' => Yii::t('app', 'Date End'), | ||
| 55 | + 'position' => Yii::t('app', 'Position'), | ||
| 56 | + 'user_id' => Yii::t('app', 'User ID'), | ||
| 57 | + 'total_count' => Yii::t('app', 'Total Count'), | ||
| 58 | + 'complete_count' => Yii::t('app', 'Complete Count'), | ||
| 59 | + 'current' => Yii::t('app', 'Current'), | ||
| 60 | + ]; | ||
| 61 | + } | ||
| 62 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace common\models; | ||
| 4 | + | ||
| 5 | +use Yii; | ||
| 6 | +use yii\base\Model; | ||
| 7 | +use yii\data\ActiveDataProvider; | ||
| 8 | +use common\models\Job; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * JobSearch represents the model behind the search form about `common\models\Job`. | ||
| 12 | + */ | ||
| 13 | +class JobSearch extends Job | ||
| 14 | +{ | ||
| 15 | + /** | ||
| 16 | + * @inheritdoc | ||
| 17 | + */ | ||
| 18 | + public function rules() | ||
| 19 | + { | ||
| 20 | + return [ | ||
| 21 | + [['job_id', 'user_id', 'total_count', 'complete_count', 'current'], 'integer'], | ||
| 22 | + [['name', 'link', 'date_start', 'date_end', 'position'], 'safe'], | ||
| 23 | + ]; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * @inheritdoc | ||
| 28 | + */ | ||
| 29 | + public function scenarios() | ||
| 30 | + { | ||
| 31 | + // bypass scenarios() implementation in the parent class | ||
| 32 | + return Model::scenarios(); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * Creates data provider instance with search query applied | ||
| 37 | + * | ||
| 38 | + * @param array $params | ||
| 39 | + * | ||
| 40 | + * @return ActiveDataProvider | ||
| 41 | + */ | ||
| 42 | + public function search($params) | ||
| 43 | + { | ||
| 44 | + $query = Job::find(); | ||
| 45 | + | ||
| 46 | + $dataProvider = new ActiveDataProvider([ | ||
| 47 | + 'query' => $query, | ||
| 48 | + ]); | ||
| 49 | + | ||
| 50 | + $this->load($params); | ||
| 51 | + | ||
| 52 | + if (!$this->validate()) { | ||
| 53 | + // uncomment the following line if you do not want to return any records when validation fails | ||
| 54 | + // $query->where('0=1'); | ||
| 55 | + return $dataProvider; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + $query->andFilterWhere([ | ||
| 59 | + 'job_id' => $this->job_id, | ||
| 60 | + 'date_start' => $this->date_start, | ||
| 61 | + 'date_end' => $this->date_end, | ||
| 62 | + 'user_id' => $this->user_id, | ||
| 63 | + 'total_count' => $this->total_count, | ||
| 64 | + 'complete_count' => $this->complete_count, | ||
| 65 | + 'current' => $this->current, | ||
| 66 | + ]); | ||
| 67 | + | ||
| 68 | + $query->andFilterWhere(['like', 'name', $this->name]) | ||
| 69 | + ->andFilterWhere(['like', 'link', $this->link]) | ||
| 70 | + ->andFilterWhere(['like', 'position', $this->position]); | ||
| 71 | + | ||
| 72 | + return $dataProvider; | ||
| 73 | + } | ||
| 74 | +} |
console/migrations/m160203_082111_jobs.php
| @@ -18,6 +18,7 @@ class m160203_082111_jobs extends Migration | @@ -18,6 +18,7 @@ class m160203_082111_jobs extends Migration | ||
| 18 | 'user_id' => $this->integer(), | 18 | 'user_id' => $this->integer(), |
| 19 | 'total_count' => $this->integer(), | 19 | 'total_count' => $this->integer(), |
| 20 | 'complete_count' => $this->integer(), | 20 | 'complete_count' => $this->integer(), |
| 21 | + 'current' => $this->smallInteger(), | ||
| 21 | ], $tableOptions); | 22 | ], $tableOptions); |
| 22 | 23 | ||
| 23 | } | 24 | } |
frontend/controllers/AccountsController.php
| @@ -3,6 +3,7 @@ namespace frontend\controllers; | @@ -3,6 +3,7 @@ namespace frontend\controllers; | ||
| 3 | 3 | ||
| 4 | use common\models\CompanyInfo; | 4 | use common\models\CompanyInfo; |
| 5 | use common\models\Fields; | 5 | use common\models\Fields; |
| 6 | +use common\models\Job; | ||
| 6 | use common\models\Language; | 7 | use common\models\Language; |
| 7 | use Yii; | 8 | use Yii; |
| 8 | use common\models\User; | 9 | use common\models\User; |
| @@ -169,7 +170,18 @@ class AccountsController extends Controller | @@ -169,7 +170,18 @@ class AccountsController extends Controller | ||
| 169 | 170 | ||
| 170 | public function actionEmployment() | 171 | public function actionEmployment() |
| 171 | { | 172 | { |
| 172 | - | 173 | + $job = Job::find()->where(['user_id' => \Yii::$app->user->getId()])->orderBy(['current' => SORT_DESC])->all(); |
| 174 | + if(empty($job)) { | ||
| 175 | + $job[] = new Job(['user_id' => \Yii::$app->user->getId(), 'current' => 0]); | ||
| 176 | + } | ||
| 177 | + if(!$job[0]->current) { | ||
| 178 | + array_unshift($job, new Job(['user_id' => \Yii::$app->user->getId(), 'current' => 1])); | ||
| 179 | + } | ||
| 180 | + if(!empty(\Yii::$app->request->post())) { | ||
| 181 | + var_dump(\Yii::$app->request->post()); | ||
| 182 | + die(); | ||
| 183 | + } | ||
| 184 | + return $this->render('employment', ['job' => $job]); | ||
| 173 | } | 185 | } |
| 174 | 186 | ||
| 175 | public function actionProjects() | 187 | public function actionProjects() |
| @@ -182,6 +194,11 @@ class AccountsController extends Controller | @@ -182,6 +194,11 @@ class AccountsController extends Controller | ||
| 182 | 194 | ||
| 183 | } | 195 | } |
| 184 | 196 | ||
| 197 | + public function actionGetForm($lastindex) | ||
| 198 | + { | ||
| 199 | + return $this->renderAjax('_job_form', ['index' => $lastindex+1]); | ||
| 200 | + } | ||
| 201 | + | ||
| 185 | /** | 202 | /** |
| 186 | * @param $id | 203 | * @param $id |
| 187 | * @return User | 204 | * @return User |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace frontend\controllers; | ||
| 4 | + | ||
| 5 | +use Yii; | ||
| 6 | +use common\models\Job; | ||
| 7 | +use common\models\JobSearch; | ||
| 8 | +use yii\web\Controller; | ||
| 9 | +use yii\web\NotFoundHttpException; | ||
| 10 | +use yii\filters\VerbFilter; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * JobController implements the CRUD actions for Job model. | ||
| 14 | + */ | ||
| 15 | +class JobController extends Controller | ||
| 16 | +{ | ||
| 17 | + public function behaviors() | ||
| 18 | + { | ||
| 19 | + return [ | ||
| 20 | + 'verbs' => [ | ||
| 21 | + 'class' => VerbFilter::className(), | ||
| 22 | + 'actions' => [ | ||
| 23 | + 'delete' => ['post'], | ||
| 24 | + ], | ||
| 25 | + ], | ||
| 26 | + ]; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * Lists all Job models. | ||
| 31 | + * @return mixed | ||
| 32 | + */ | ||
| 33 | + public function actionIndex() | ||
| 34 | + { | ||
| 35 | + $searchModel = new JobSearch(); | ||
| 36 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
| 37 | + | ||
| 38 | + return $this->render('index', [ | ||
| 39 | + 'searchModel' => $searchModel, | ||
| 40 | + 'dataProvider' => $dataProvider, | ||
| 41 | + ]); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Displays a single Job model. | ||
| 46 | + * @param integer $id | ||
| 47 | + * @return mixed | ||
| 48 | + */ | ||
| 49 | + public function actionView($id) | ||
| 50 | + { | ||
| 51 | + return $this->render('view', [ | ||
| 52 | + 'model' => $this->findModel($id), | ||
| 53 | + ]); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * Creates a new Job model. | ||
| 58 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
| 59 | + * @return mixed | ||
| 60 | + */ | ||
| 61 | + public function actionCreate() | ||
| 62 | + { | ||
| 63 | + $model = new Job(); | ||
| 64 | + | ||
| 65 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
| 66 | + return $this->redirect(['view', 'id' => $model->job_id]); | ||
| 67 | + } else { | ||
| 68 | + return $this->render('create', [ | ||
| 69 | + 'model' => $model, | ||
| 70 | + ]); | ||
| 71 | + } | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * Updates an existing Job model. | ||
| 76 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
| 77 | + * @param integer $id | ||
| 78 | + * @return mixed | ||
| 79 | + */ | ||
| 80 | + public function actionUpdate($id) | ||
| 81 | + { | ||
| 82 | + $model = $this->findModel($id); | ||
| 83 | + | ||
| 84 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
| 85 | + return $this->redirect(['view', 'id' => $model->job_id]); | ||
| 86 | + } else { | ||
| 87 | + return $this->render('update', [ | ||
| 88 | + 'model' => $model, | ||
| 89 | + ]); | ||
| 90 | + } | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + /** | ||
| 94 | + * Deletes an existing Job model. | ||
| 95 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
| 96 | + * @param integer $id | ||
| 97 | + * @return mixed | ||
| 98 | + */ | ||
| 99 | + public function actionDelete($id) | ||
| 100 | + { | ||
| 101 | + $this->findModel($id)->delete(); | ||
| 102 | + | ||
| 103 | + return $this->redirect(['index']); | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + /** | ||
| 107 | + * Finds the Job model based on its primary key value. | ||
| 108 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
| 109 | + * @param integer $id | ||
| 110 | + * @return Job the loaded model | ||
| 111 | + * @throws NotFoundHttpException if the model cannot be found | ||
| 112 | + */ | ||
| 113 | + protected function findModel($id) | ||
| 114 | + { | ||
| 115 | + if (($model = Job::findOne($id)) !== null) { | ||
| 116 | + return $model; | ||
| 117 | + } else { | ||
| 118 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
| 119 | + } | ||
| 120 | + } | ||
| 121 | +} |
| 1 | +<?php | ||
| 2 | + /** | ||
| 3 | + * @var integer $index | ||
| 4 | + */ | ||
| 5 | + use common\models\Job; | ||
| 6 | + use yii\jui\DatePicker; | ||
| 7 | + use yii\widgets\ActiveForm; | ||
| 8 | + | ||
| 9 | + $model = new Job(['user_id' => \Yii::$app->user->getId (), 'current' => 0]); | ||
| 10 | + $form = ActiveForm::begin (); | ||
| 11 | + echo "<div class='ajax-loaded'><div class='prev_job_inputs'>"; | ||
| 12 | + echo $form->field ($model, '[' . $index . ']name') | ||
| 13 | + ->label ('Название') | ||
| 14 | + ->textInput (); | ||
| 15 | + echo $form->field ($model, '[' . $index . ']link') | ||
| 16 | + ->label ('Ссылка на компанию на сайте МФП') | ||
| 17 | + ->textInput (); | ||
| 18 | + echo $form->field ($model, '[' . $index . ']date_start') | ||
| 19 | + ->label ('Дата начала работы') | ||
| 20 | + ->widget (DatePicker::className (), ['language' => 'ru', 'dateFormat' => 'dd-MM-yyyy']); | ||
| 21 | + echo $form->field ($model, '[' . $index . ']date_end') | ||
| 22 | + ->label ('Дата окончания работы') | ||
| 23 | + ->widget (DatePicker::className (), ['language' => 'ru', 'dateFormat' => 'dd-MM-yyyy']); | ||
| 24 | + echo $form->field ($model, '[' . $index . ']position') | ||
| 25 | + ->label ('Должность') | ||
| 26 | + ->textInput (); | ||
| 27 | + echo $form->field ($model, '[' . $index . ']total_count') | ||
| 28 | + ->label ('Количество проектов, в которых принимали участие') | ||
| 29 | + ->input ('number'); | ||
| 30 | + echo $form->field ($model, '[' . $index . ']complete_count') | ||
| 31 | + ->label ('из них реализовано') | ||
| 32 | + ->input ('number'); | ||
| 33 | + echo "</div></div>"; | ||
| 34 | + $form->end (); | ||
| 35 | +?> |
frontend/views/accounts/employment.php
| 1 | <?php | 1 | <?php |
| 2 | -use common\models\Option; | ||
| 3 | -use yii\helpers\Html; | ||
| 4 | -use yii\widgets\ActiveForm; | ||
| 5 | -use \common\widgets\MultiLangForm; | 2 | + /** |
| 3 | + * @var Job[] $job | ||
| 4 | + */ | ||
| 5 | + use common\models\Job; | ||
| 6 | + use yii\helpers\Html; | ||
| 7 | + use yii\jui\DatePicker; | ||
| 8 | + use yii\widgets\ActiveForm; | ||
| 6 | 9 | ||
| 7 | - $this->title = 'Мой профиль'; | 10 | + $this->title = 'Трудовой стаж'; |
| 8 | $this->params['breadcrumbs'][] = $this->title; | 11 | $this->params['breadcrumbs'][] = $this->title; |
| 9 | ?> | 12 | ?> |
| 10 | - | ||
| 11 | -<h1><?= $this->title ?></h1> | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | 13 | + <h1><?= $this->title ?></h1> |
| 15 | <?php | 14 | <?php |
| 16 | - | ||
| 17 | -$form = $this->render('_form', [ | ||
| 18 | - 'user' => $user, | ||
| 19 | - 'user_info' => $user_info, | ||
| 20 | -]); | ||
| 21 | - | ||
| 22 | -echo MultiLangForm::widget(['form'=>$form]); | ||
| 23 | - | 15 | + $form = ActiveForm::begin (); |
| 16 | + $current = array_shift ($job); | ||
| 24 | ?> | 17 | ?> |
| 25 | - | ||
| 26 | - | 18 | + <div class="current_job_container"> |
| 19 | + <p>Текущее место работы:</p> | ||
| 20 | + <div class="current_job_inputs"> | ||
| 21 | + <?php | ||
| 22 | + echo $form->field ($current, '[0]current') | ||
| 23 | + ->label (false) | ||
| 24 | + ->hiddenInput (['value' => 1]); | ||
| 25 | + echo $form->field ($current, '[0]name') | ||
| 26 | + ->label ('Название') | ||
| 27 | + ->textInput (); | ||
| 28 | + echo $form->field ($current, '[0]link') | ||
| 29 | + ->label ('Ссылка на компанию на сайте МФП') | ||
| 30 | + ->textInput (); | ||
| 31 | + echo $form->field ($current, '[0]date_start') | ||
| 32 | + ->label ('Дата начала работы') | ||
| 33 | + ->widget (DatePicker::className (), ['language' => 'ru', 'dateFormat' => 'dd-MM-yyyy']); | ||
| 34 | + echo $form->field ($current, '[0]position') | ||
| 35 | + ->label ('Должность') | ||
| 36 | + ->textInput (); | ||
| 37 | + echo $form->field ($current, '[0]total_count') | ||
| 38 | + ->label ('Количество проектов, в которых принимали участие') | ||
| 39 | + ->input ('number'); | ||
| 40 | + echo $form->field ($current, '[0]complete_count') | ||
| 41 | + ->label ('из них реализовано') | ||
| 42 | + ->input ('number'); | ||
| 43 | + ?> | ||
| 44 | + </div> | ||
| 45 | + </div> | ||
| 46 | + <div class="prev_job_container"> | ||
| 47 | + <p>Предыдущие места работы</p> | ||
| 48 | + <?php | ||
| 49 | + foreach ($job as $index => $job_model) | ||
| 50 | + { | ||
| 51 | + echo "<div class='prev_job_inputs'>"; | ||
| 52 | + echo $form->field ($job_model, '['. ($index + 1) .']name') | ||
| 53 | + ->label ('Название') | ||
| 54 | + ->textInput (); | ||
| 55 | + echo $form->field ($job_model, '['. ($index + 1) .']link') | ||
| 56 | + ->label ('Ссылка на компанию на сайте МФП') | ||
| 57 | + ->textInput (); | ||
| 58 | + echo $form->field ($job_model, '['. ($index + 1) .']date_start') | ||
| 59 | + ->label ('Дата начала работы') | ||
| 60 | + ->widget (DatePicker::className (), ['language' => 'ru', 'dateFormat' => 'dd-MM-yyyy']); | ||
| 61 | + echo $form->field ($job_model, '['. ($index + 1) .']date_end') | ||
| 62 | + ->label ('Дата окончания работы') | ||
| 63 | + ->widget (DatePicker::className (), ['language' => 'ru', 'dateFormat' => 'dd-MM-yyyy']); | ||
| 64 | + echo $form->field ($job_model, '['. ($index + 1) .']position') | ||
| 65 | + ->label ('Должность') | ||
| 66 | + ->textInput (); | ||
| 67 | + echo $form->field ($job_model, '['. ($index + 1) .']total_count') | ||
| 68 | + ->label ('Количество проектов, в которых принимали участие') | ||
| 69 | + ->input ('number'); | ||
| 70 | + echo $form->field ($job_model, '['. ($index + 1) .']complete_count') | ||
| 71 | + ->label ('из них реализовано') | ||
| 72 | + ->input ('number'); | ||
| 73 | + echo "</div>"; | ||
| 74 | + } | ||
| 75 | + ?> | ||
| 76 | + </div> | ||
| 77 | +<?php | ||
| 78 | + echo Html::button('Добавить место работы', ['id' => 'add_job_button']); | ||
| 79 | + $form->end (); | ||
| 80 | +?> | ||
| 81 | +<script> | ||
| 82 | + $(function() { | ||
| 83 | + var regexp = /^[\w]+\[(\d+)\].*$/; | ||
| 84 | + $(document).on('click', '#add_job_button', function() { | ||
| 85 | + var inputs = $('.prev_job_inputs').last(); | ||
| 86 | + var name = $(inputs).find('input, textarea').first().attr('name'); | ||
| 87 | + var lastindex = regexp.exec(name)[1]; | ||
| 88 | + $.get('/accounts/get-form', { lastindex: lastindex }, function(data) { | ||
| 89 | + $('.prev_job_container').append($(data).find('.ajax-loaded').first().html()); | ||
| 90 | + $(data).filter('script').appendTo('body'); | ||
| 91 | + }); | ||
| 92 | + }); | ||
| 93 | + }); | ||
| 94 | +</script> |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\helpers\Html; | ||
| 4 | +use yii\widgets\ActiveForm; | ||
| 5 | + | ||
| 6 | +/* @var $this yii\web\View */ | ||
| 7 | +/* @var $model common\models\JobSearch */ | ||
| 8 | +/* @var $form yii\widgets\ActiveForm */ | ||
| 9 | +?> | ||
| 10 | + | ||
| 11 | +<div class="job-search"> | ||
| 12 | + | ||
| 13 | + <?php $form = ActiveForm::begin([ | ||
| 14 | + 'action' => ['index'], | ||
| 15 | + 'method' => 'get', | ||
| 16 | + ]); ?> | ||
| 17 | + | ||
| 18 | + <?= $form->field($model, 'job_id') ?> | ||
| 19 | + | ||
| 20 | + <?= $form->field($model, 'name') ?> | ||
| 21 | + | ||
| 22 | + <?= $form->field($model, 'link') ?> | ||
| 23 | + | ||
| 24 | + <?= $form->field($model, 'date_start') ?> | ||
| 25 | + | ||
| 26 | + <?= $form->field($model, 'date_end') ?> | ||
| 27 | + | ||
| 28 | + <?php // echo $form->field($model, 'position') ?> | ||
| 29 | + | ||
| 30 | + <?php // echo $form->field($model, 'user_id') ?> | ||
| 31 | + | ||
| 32 | + <?php // echo $form->field($model, 'total_count') ?> | ||
| 33 | + | ||
| 34 | + <?php // echo $form->field($model, 'complete_count') ?> | ||
| 35 | + | ||
| 36 | + <?php // echo $form->field($model, 'current') ?> | ||
| 37 | + | ||
| 38 | + <div class="form-group"> | ||
| 39 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | ||
| 40 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | ||
| 41 | + </div> | ||
| 42 | + | ||
| 43 | + <?php ActiveForm::end(); ?> | ||
| 44 | + | ||
| 45 | +</div> |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\helpers\Html; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +/* @var $this yii\web\View */ | ||
| 7 | +/* @var $model common\models\Job */ | ||
| 8 | + | ||
| 9 | +$this->title = Yii::t('app', 'Create Job'); | ||
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Jobs'), 'url' => ['index']]; | ||
| 11 | +$this->params['breadcrumbs'][] = $this->title; | ||
| 12 | +?> | ||
| 13 | +<div class="job-create"> | ||
| 14 | + | ||
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
| 16 | + | ||
| 17 | + <?= $this->render('_form', [ | ||
| 18 | + 'model' => $model, | ||
| 19 | + ]) ?> | ||
| 20 | + | ||
| 21 | +</div> |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\helpers\Html; | ||
| 4 | +use yii\grid\GridView; | ||
| 5 | + | ||
| 6 | +/* @var $this yii\web\View */ | ||
| 7 | +/* @var $searchModel common\models\JobSearch */ | ||
| 8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
| 9 | + | ||
| 10 | +$this->title = Yii::t('app', 'Jobs'); | ||
| 11 | +$this->params['breadcrumbs'][] = $this->title; | ||
| 12 | +?> | ||
| 13 | +<div class="job-index"> | ||
| 14 | + | ||
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
| 16 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
| 17 | + | ||
| 18 | + <p> | ||
| 19 | + <?= Html::a(Yii::t('app', 'Create Job'), ['create'], ['class' => 'btn btn-success']) ?> | ||
| 20 | + </p> | ||
| 21 | + | ||
| 22 | + <?= GridView::widget([ | ||
| 23 | + 'dataProvider' => $dataProvider, | ||
| 24 | + 'filterModel' => $searchModel, | ||
| 25 | + 'columns' => [ | ||
| 26 | + ['class' => 'yii\grid\SerialColumn'], | ||
| 27 | + | ||
| 28 | + 'job_id', | ||
| 29 | + 'name', | ||
| 30 | + 'link', | ||
| 31 | + 'date_start', | ||
| 32 | + 'date_end', | ||
| 33 | + // 'position', | ||
| 34 | + // 'user_id', | ||
| 35 | + // 'total_count', | ||
| 36 | + // 'complete_count', | ||
| 37 | + // 'current', | ||
| 38 | + | ||
| 39 | + ['class' => 'yii\grid\ActionColumn'], | ||
| 40 | + ], | ||
| 41 | + ]); ?> | ||
| 42 | + | ||
| 43 | +</div> |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\helpers\Html; | ||
| 4 | + | ||
| 5 | +/* @var $this yii\web\View */ | ||
| 6 | +/* @var $model common\models\Job */ | ||
| 7 | + | ||
| 8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | ||
| 9 | + 'modelClass' => 'Job', | ||
| 10 | +]) . ' ' . $model->name; | ||
| 11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Jobs'), 'url' => ['index']]; | ||
| 12 | +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->job_id]]; | ||
| 13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | ||
| 14 | +?> | ||
| 15 | +<div class="job-update"> | ||
| 16 | + | ||
| 17 | + <h1><?= Html::encode($this->title) ?></h1> | ||
| 18 | + | ||
| 19 | + <?= $this->render('_form', [ | ||
| 20 | + 'model' => $model, | ||
| 21 | + ]) ?> | ||
| 22 | + | ||
| 23 | +</div> |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\helpers\Html; | ||
| 4 | +use yii\widgets\DetailView; | ||
| 5 | + | ||
| 6 | +/* @var $this yii\web\View */ | ||
| 7 | +/* @var $model common\models\Job */ | ||
| 8 | + | ||
| 9 | +$this->title = $model->name; | ||
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Jobs'), 'url' => ['index']]; | ||
| 11 | +$this->params['breadcrumbs'][] = $this->title; | ||
| 12 | +?> | ||
| 13 | +<div class="job-view"> | ||
| 14 | + | ||
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
| 16 | + | ||
| 17 | + <p> | ||
| 18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->job_id], ['class' => 'btn btn-primary']) ?> | ||
| 19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->job_id], [ | ||
| 20 | + 'class' => 'btn btn-danger', | ||
| 21 | + 'data' => [ | ||
| 22 | + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | ||
| 23 | + 'method' => 'post', | ||
| 24 | + ], | ||
| 25 | + ]) ?> | ||
| 26 | + </p> | ||
| 27 | + | ||
| 28 | + <?= DetailView::widget([ | ||
| 29 | + 'model' => $model, | ||
| 30 | + 'attributes' => [ | ||
| 31 | + 'job_id', | ||
| 32 | + 'name', | ||
| 33 | + 'link', | ||
| 34 | + 'date_start', | ||
| 35 | + 'date_end', | ||
| 36 | + 'position', | ||
| 37 | + 'user_id', | ||
| 38 | + 'total_count', | ||
| 39 | + 'complete_count', | ||
| 40 | + 'current', | ||
| 41 | + ], | ||
| 42 | + ]) ?> | ||
| 43 | + | ||
| 44 | +</div> |