diff --git a/common/config/main.php b/common/config/main.php index 1be91dc..24cf3da 100755 --- a/common/config/main.php +++ b/common/config/main.php @@ -46,6 +46,9 @@ return [ 'cache' => [ 'class' => 'yii\caching\FileCache', ], + 'formatter' => [ + 'booleanFormat' => ['Нет', 'Да'], + ], 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, diff --git a/common/models/TeamSearch.php b/common/models/TeamSearch.php new file mode 100644 index 0000000..0bc6011 --- /dev/null +++ b/common/models/TeamSearch.php @@ -0,0 +1,80 @@ + $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; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'team_id' => $this->team_id, + 'user_id' => $this->user_id, + 'department_id' => $this->department_id, + 'date_add' => $this->date_add, + 'user_add_id' => $this->user_add_id, + 'experience_from' => $this->experience_from, + ]); + + $query->andFilterWhere(['like', 'firstname', $this->firstname]) + ->andFilterWhere(['like', 'lastname', $this->lastname]) + ->andFilterWhere(['like', 'middlename', $this->middlename]) + ->andFilterWhere(['like', 'link', $this->link]) + ->andFilterWhere(['like', 'position', $this->position]) + ->andFilterWhere(['like', 'photo', $this->photo]) + ->andFilterWhere(['like', 'country_id', $this->country_id]); + + return $dataProvider; + } +} diff --git a/common/models/User.php b/common/models/User.php index 19a92e7..2c152d3 100755 --- a/common/models/User.php +++ b/common/models/User.php @@ -1,283 +1,382 @@ self::STATUS_ACTIVE], - ['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED]], - [['username', 'lastname', 'firstname', 'middlename'], 'string', 'max' => 255], - [['firstname'], 'required'], - [['type'], 'in', 'range' => [1, 2]], - [['type'], 'default', 'value' => '1',], - ]; - } + /** + * @var array EAuth attributes + */ - /** - * @inheritdoc - */ - public static function findIdentity($id) { - if(Yii::$app->getSession()->has('user-'.$id)) { - if (Yii::$app->getSession()->has('user-'.$id)) { - return new self(Yii::$app->getSession()->get('user-'.$id)); + const STATUS_DELETED = 0; + const STATUS_ACTIVE = 10; + + public $profile; + + public $old_password; + + public $new_password; + + public $password_reply; + + /** + * @inheritdoc + */ + public static function tableName() + { + return '{{%user}}'; + } + + /** + * @inheritdoc + */ + public function behaviors() + { + return [ + TimestampBehavior::className(), + ]; + } + + /** + * @inheritdoc + */ + public function rules() + { + return [ + [ + 'status', + 'default', + 'value' => self::STATUS_ACTIVE, + ], + [ + 'status', + 'in', + 'range' => [ + self::STATUS_ACTIVE, + self::STATUS_DELETED, + ], + ], + [ + [ + 'username', + 'lastname', + 'firstname', + 'middlename', + ], + 'string', + 'max' => 255, + ], + [ + [ 'firstname' ], + 'required', + ], + [ + [ 'type' ], + 'in', + 'range' => [ + 1, + 2, + ], + ], + [ + [ 'type' ], + 'default', + 'value' => '1', + ], + [ + [ + 'specializationInput', + 'paymentInput', + ], + 'safe', + ], + ]; + } + + /** + * @inheritdoc + */ + public static function findIdentity($id) + { + if(Yii::$app->getSession() + ->has('user-' . $id) + ) { + if(Yii::$app->getSession() + ->has('user-' . $id) + ) { + return new self(Yii::$app->getSession() + ->get('user-' . $id)); + } else { + return isset( self::$users[ $id ] ) ? new self(self::$users[ $id ]) : NULL; + } + } else { + return static::findOne([ + 'id' => $id, + 'status' => self::STATUS_ACTIVE, + ]); } - else { - return isset(self::$users[$id]) ? new self(self::$users[$id]) : null; - } - } - else { - return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]); + } - - } - /** - * @param \nodge\eauth\ServiceBase $service - * @return User - * @throws ErrorException - */ - public static function findByEAuth($service) { - if (!$service->getIsAuthenticated()) { - throw new ErrorException('EAuth user should be authenticated before creating identity.'); + + /** + * @param \nodge\eauth\ServiceBase $service + * + * @return User + * @throws ErrorException + */ + public static function findByEAuth($service) + { + if(!$service->getIsAuthenticated()) { + throw new ErrorException('EAuth user should be authenticated before creating identity.'); + } + $id = $service->getServiceName() . '-' . $service->getId(); + $attributes = [ + 'id' => $id, + 'username' => $service->getAttribute('name'), + 'authKey' => md5($id), + 'profile' => $service->getAttributes(), + ]; + $attributes[ 'profile' ][ 'service' ] = $service->getServiceName(); + Yii::$app->getSession() + ->set('user-' . $id, $attributes); + return new self($attributes); } - $id = $service->getServiceName().'-'.$service->getId(); - $attributes = array( - 'id' => $id, - 'username' => $service->getAttribute('name'), - 'authKey' => md5($id), - 'profile' => $service->getAttributes(), - ); - $attributes['profile']['service'] = $service->getServiceName(); - Yii::$app->getSession()->set('user-'.$id, $attributes); - return new self($attributes); - } - public $authKey; + public $authKey; - /** - * @inheritdoc - */ - public static function findIdentityByAccessToken($token, $type = null) - { - throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.'); - } + /** + * @inheritdoc + */ + public static function findIdentityByAccessToken($token, $type = NULL) + { + throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.'); + } - /** - * Finds user by username - * - * @param string $username - * @return static|null - */ - public static function findByUsername($username) - { - return static::findOne(['username' => $username, 'status' => self::STATUS_ACTIVE]); - } + /** + * Finds user by username + * + * @param string $username + * + * @return static|null + */ + public static function findByUsername($username) + { + return static::findOne([ + 'username' => $username, + 'status' => self::STATUS_ACTIVE, + ]); + } - /** - * Finds user by password reset token - * - * @param string $token password reset token - * @return static|null - */ - public static function findByPasswordResetToken($token) - { - if (!static::isPasswordResetTokenValid($token)) { - return null; + /** + * Finds user by password reset token + * + * @param string $token password reset token + * + * @return static|null + */ + public static function findByPasswordResetToken($token) + { + if(!static::isPasswordResetTokenValid($token)) { + return NULL; + } + + return static::findOne([ + 'password_reset_token' => $token, + 'status' => self::STATUS_ACTIVE, + ]); } - return static::findOne([ - 'password_reset_token' => $token, - 'status' => self::STATUS_ACTIVE, - ]); - } + /** + * Finds out if password reset token is valid + * + * @param string $token password reset token + * + * @return boolean + */ + public static function isPasswordResetTokenValid($token) + { + if(empty( $token )) { + return false; + } - /** - * Finds out if password reset token is valid - * - * @param string $token password reset token - * @return boolean - */ - public static function isPasswordResetTokenValid($token) - { - if (empty($token)) { - return false; + $timestamp = (int) substr($token, strrpos($token, '_') + 1); + $expire = Yii::$app->params[ 'user.passwordResetTokenExpire' ]; + return $timestamp + $expire >= time(); } - $timestamp = (int) substr($token, strrpos($token, '_') + 1); - $expire = Yii::$app->params['user.passwordResetTokenExpire']; - return $timestamp + $expire >= time(); - } + /** + * @inheritdoc + */ + public function getId() + { + return $this->getPrimaryKey(); + } - /** - * @inheritdoc - */ - public function getId() - { - return $this->getPrimaryKey(); - } + /** + * @inheritdoc + */ + public function getAuthKey() + { + return $this->auth_key; + } - /** - * @inheritdoc - */ - public function getAuthKey() - { - return $this->auth_key; - } + /** + * @inheritdoc + */ + public function validateAuthKey($authKey) + { + return $this->getAuthKey() === $authKey; + } - /** - * @inheritdoc - */ - public function validateAuthKey($authKey) - { - return $this->getAuthKey() === $authKey; - } + /** + * Validates password + * + * @param string $password password to validate + * + * @return boolean if password provided is valid for current user + */ + public function validatePassword($password) + { + return Yii::$app->security->validatePassword($password, $this->password_hash); + } - /** - * Validates password - * - * @param string $password password to validate - * @return boolean if password provided is valid for current user - */ - public function validatePassword($password) - { - return Yii::$app->security->validatePassword($password, $this->password_hash); - } + /** + * Generates password hash from password and sets it to the model + * + * @param string $password + */ + public function setPassword($password) + { + $this->password_hash = Yii::$app->security->generatePasswordHash($password); + } - /** - * Generates password hash from password and sets it to the model - * - * @param string $password - */ - public function setPassword($password) - { - $this->password_hash = Yii::$app->security->generatePasswordHash($password); - } + /** + * Generates "remember me" authentication key + */ + public function generateAuthKey() + { + $this->auth_key = Yii::$app->security->generateRandomString(); + } - /** - * Generates "remember me" authentication key - */ - public function generateAuthKey() - { - $this->auth_key = Yii::$app->security->generateRandomString(); - } + /** + * Generates new password reset token + */ + public function generatePasswordResetToken() + { + $this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time(); + } - /** - * Generates new password reset token - */ - public function generatePasswordResetToken() - { - $this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time(); - } + /** + * Removes password reset token + */ + public function removePasswordResetToken() + { + $this->password_reset_token = NULL; + } - /** - * Removes password reset token - */ - public function removePasswordResetToken() - { - $this->password_reset_token = null; - } - - public function getUserName() - { - return $this->username; - } + public function getUserName() + { + return $this->username; + } - public function getRoles() - { - $auth = \Yii::$app->authManager; - $roles = $this->getRoleChildrenRecursive($auth->getRolesByUser($this->id), $auth); - return $roles; - } + public function getRoles() + { + $auth = \Yii::$app->authManager; + $roles = $this->getRoleChildrenRecursive($auth->getRolesByUser($this->id), $auth); + return $roles; + } - protected function getRoleChildrenRecursive($roles, $auth, $result = []) - { - if(is_array($roles) && !empty($roles)) + protected function getRoleChildrenRecursive($roles, $auth, $result = [ ]) { - foreach($roles as $role => $item) - { - if(!($item instanceof \yii\rbac\Role)) { - continue; + if(is_array($roles) && !empty( $roles )) { + foreach($roles as $role => $item) { + if(!( $item instanceof \yii\rbac\Role )) { + continue; + } + $result[] = $role; + $result = self::getRoleChildrenRecursive($auth->getChildren($role), $auth, $result); } - $result[] = $role; - $result = self::getRoleChildrenRecursive($auth->getChildren($role), $auth, $result); + return $result; + } else { + return $result; } - return $result; - } else { - return $result; } - } -// public function afterSave ($insert, $changedAttributes) -// { -// parent::afterSave ($insert, $changedAttributes); -// \Yii::$app->options->createOptions($this->id); -// } + // public function afterSave ($insert, $changedAttributes) + // { + // parent::afterSave ($insert, $changedAttributes); + // \Yii::$app->options->createOptions($this->id); + // } - public function getUserInfo(){ - return $this->hasOne(UserInfo::className(), ['user_id' => 'id']); - } + public function getUserInfo() + { + return $this->hasOne(UserInfo::className(), [ 'user_id' => 'id' ]); + } - public function getIsPerformer() - { - return true; - } + public function getIsPerformer() + { + return true; + } + + public function getIsCustomer() + { + return true; + } + + public function getPayments() + { + return $this->hasMany(Payment::className(), [ 'payment_id' => 'payment_id' ]) + ->viaTable('user_payment', [ 'user_id' => 'id' ]); + } + + public function getPaymentInput() + { + return $this->getPayments() + ->asArray() + ->column(); + } + + public function setPaymentInput($value) + { + $this->paymentInput = $value; + } + + public function getSpecializations() + { + return $this->hasMany(Specialization::className(), [ 'specialization_id' => 'specialization_id' ]) + ->viaTable('user_specialization', [ 'user_id' => 'id' ]); + } + + public function getSpecializationInput() + { + return $this->getSpecializations() + ->asArray() + ->column(); + } + + public function setSpecializationInput($value) + { + $this->specializationInput = $value; + } - public function getIsCustomer() - { - return true; } -} diff --git a/frontend/controllers/AccountsController.php b/frontend/controllers/AccountsController.php index 3a1bd40..45f0725 100755 --- a/frontend/controllers/AccountsController.php +++ b/frontend/controllers/AccountsController.php @@ -16,6 +16,7 @@ use common\models\Project; use common\models\Specialization; use common\models\Team; + use common\models\TeamSearch; use common\models\UserPayment; use common\models\UserSpecialization; use common\models\Vacancy; @@ -269,43 +270,13 @@ public function actionService() { + $user = \Yii::$app->user->identity; $user_info = UserInfo::find() ->where([ 'user_id' => \Yii::$app->user->getId() ]) ->one(); if(empty( $user_info )) { $user_info = new UserInfo([ 'user_id' => \Yii::$app->user->getId() ]); } - $post = \Yii::$app->request->post(); - if(!empty( $post )) { - $user_info->load($post); - $user_info->save(); - $user_specialization_values = [ ]; - $user_payment_values = [ ]; - UserSpecialization::deleteAll([ 'user_id' => \Yii::$app->user->getId() ]); - UserPayment::deleteAll([ 'user_id' => \Yii::$app->user->getId() ]); - foreach($post[ 'UserSpecialization' ][ 'specialization_id' ] as $index => $value) { - $user_specialization_values[] = (new UserSpecialization([ - 'user_id' => \Yii::$app->user->getId(), - 'specialization_id' => $value, - ]))->save(); - } - foreach($post[ 'UserPayment' ][ 'payment_id' ] as $index => $value) { - $user_payment_values[] = (new UserPayment([ - 'user_id' => \Yii::$app->user->getId(), - 'payment_id' => $value, - ]))->save(); - } - } - $user_specialization = UserSpecialization::find() - ->where([ 'user_id' => \Yii::$app->user->getId() ]) - ->select([ 'specialization_id' ]) - ->column(); - $user_payment = UserPayment::find() - ->where([ 'user_id' => \Yii::$app->user->getId() ]) - ->select([ 'payment_id' ]) - ->column(); - $user_specialization_input = new UserSpecialization([ 'user_id' => \Yii::$app->user->getId() ]); - $user_payment_input = new UserPayment([ 'user_id' => \Yii::$app->user->getId() ]); $specialization = Specialization::find() ->select([ 'specialization_name', @@ -322,14 +293,28 @@ ->indexBy('payment_id') ->asArray() ->column(); + $post = \Yii::$app->request->post(); + if(!empty( $post )) { + $user_info->load($post); + $user_info->validate(); + if(!$user_info->hasErrors()) { + $user_info->save(); + $user->load($post); + $user->unlinkAll('specializations', true); + foreach($user->specializationInput as $one_specialization) { + $user->link('specializations', Specialization::findOne($one_specialization)); + } + $user->unlinkAll('payments', true); + foreach($user->paymentInput as $one_payment) { + $user->link('payments', Payment::findOne($one_payment)); + } + } + } return $this->render('service', [ - 'user_info' => $user_info, - 'specialization' => $specialization, - 'user_specialization' => $user_specialization, - 'user_specialization_input' => $user_specialization_input, - 'payment' => $payment, - 'user_payment' => $user_payment, - 'user_payment_input' => $user_payment_input, + 'user' => $user, + 'user_info' => $user_info, + 'specialization' => $specialization, + 'payment' => $payment, ]); } @@ -437,6 +422,18 @@ $project->load($post); $project->validate(); if(!$project->hasErrors()) { + $date_end = new \DateTime(); + switch($post[ 'Project' ][ 'date_end' ]) { + case 2: + $date_end->modify('+14 day'); + break; + case 3: + $date_end->modify('+30 day'); + break; + default: + $date_end->modify('+7 day'); + }; + $project->date_end = \Yii::$app->formatter->asDate($date_end->getTimestamp(), 'short'); $project->save(); $project->unlinkAll('specializations', true); foreach($project->specializationInput as $one_specialization) { @@ -497,6 +494,18 @@ $project->load($post); $project->validate(); if(!$project->hasErrors()) { + $date_end = new \DateTime(); + switch($post[ 'Project' ][ 'date_end' ]) { + case 2: + $date_end->modify('+14 day'); + break; + case 3: + $date_end->modify('+30 day'); + break; + default: + $date_end->modify('+7 day'); + }; + $project->date_end = \Yii::$app->formatter->asDate($date_end->getTimestamp(), 'short'); $project->save(); $project->unlinkAll('specializations', true); foreach($project->specializationInput as $one_specialization) { @@ -568,7 +577,13 @@ public function actionTeam() { - return $this->render('team'); + $searchModel = new TeamSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('team', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); } public function actionTeamCreate() diff --git a/frontend/controllers/TeamController.php b/frontend/controllers/TeamController.php new file mode 100644 index 0000000..f826ce7 --- /dev/null +++ b/frontend/controllers/TeamController.php @@ -0,0 +1,124 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all Team models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new TeamSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single Team model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Team model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Team(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->team_id]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing Team 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); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->team_id]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing Team model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the Team model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Team the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Team::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/frontend/views/accounts/_projects_form.php b/frontend/views/accounts/_projects_form.php index 7e80c66..eef4262 100644 --- a/frontend/views/accounts/_projects_form.php +++ b/frontend/views/accounts/_projects_form.php @@ -86,10 +86,9 @@ field($project, 'date_end') ->dropDownList([ - 'День', - 'Неделю', - 'Месяц', - 'Год', + 1 => 'Неделя', + 2 => '2 неделю', + 3 => 'Месяц', ]) ?> diff --git a/frontend/views/accounts/service.php b/frontend/views/accounts/service.php index d8066de..97a1406 100755 --- a/frontend/views/accounts/service.php +++ b/frontend/views/accounts/service.php @@ -1,23 +1,17 @@ title = 'Мой профиль'; $this->params[ 'breadcrumbs' ][] = $this->title; - $user_specialization_input->specialization_id = $user_specialization; - $user_payment_input->payment_id = $user_payment; ?>

title ?>

Рекомендуем детально заполнить для исполнителя. Это сильно влияет на количество заказов.

@@ -30,7 +24,7 @@ ]) ->label('Стоимость работ') ->textInput() ?> -field($user_specialization_input, 'specialization_id') +field($user, 'specializationInput') ->label('Специализация услуг') ->checkboxList($specialization) ?> field($user_info, 'guarantee', [ @@ -69,7 +63,7 @@ ]) ->label('Минимальная предоплата за работы') ->textInput() ?> -field($user_payment_input, 'payment_id') +field($user, 'paymentInput') ->label('Способы оплаты') ->checkboxList($payment) ?> diff --git a/frontend/views/accounts/team.php b/frontend/views/accounts/team.php new file mode 100644 index 0000000..4f169bb --- /dev/null +++ b/frontend/views/accounts/team.php @@ -0,0 +1,64 @@ +title = 'Команда'; + $this->params[ 'breadcrumbs' ][] = $this->title; +?> +

title ?>

+

+ 'btn btn-success' ]) ?> +

+ $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + [ + 'attribute' => 'team_id', + 'label' => 'ID', + ], + [ + 'value' => function($model, $key, $index, $column) { + return $model->lastname.' '.$model->firstname.' '.$model->middlename; + }, + 'label' => 'ФИО', + ], + [ + 'value' => function($model, $key, $index, $column) { + return \Yii::$app->formatter->asBoolean(!empty($model->link)); + }, + 'label' => 'Участник МФП', + ], + [ + 'attribute' => 'department.name', + 'label' => 'Отдел компании', + ], + [ + 'value' => function($model, $key, $index, $column) { + return \Yii::$app->formatter->asDate(time(), 'yyyy') - $model->experience_from; + }, + 'label' => 'Опыл, лет', + ], + 'team_id', + 'user_id', + 'firstname', + 'lastname', + 'middlename', + // 'link', + // 'position', + // 'department_id', + // 'date_add', + // 'user_add_id', + // 'photo', + // 'country_id', + // 'experience_from', + + [ 'class' => 'yii\grid\ActionColumn' ], + ], +]); ?> \ No newline at end of file diff --git a/frontend/views/layouts/admin.php b/frontend/views/layouts/admin.php index e3c6cae..7ab29e2 100755 --- a/frontend/views/layouts/admin.php +++ b/frontend/views/layouts/admin.php @@ -34,7 +34,7 @@ $this->beginContent('@app/views/layouts/main.php'); ], [ 'label' => 'Трудовой стаж', - 'url' => ['accounts/'], + 'url' => ['accounts/employment'], ], [ 'label' => 'Дополнительные навыки', @@ -42,30 +42,30 @@ $this->beginContent('@app/views/layouts/main.php'); ], [ 'label' => 'Описание', - 'url' => ['accounts/'], + 'url' => ['accounts/description'], ], [ 'label' => 'Команда', - 'url' => ['accounts/'], + 'url' => ['accounts/team'], ], [ 'label' => 'Вакансии', - 'url' => ['accounts/'], + 'url' => ['accounts/vacancy'], ], [ 'label' => 'Ваши проекты', - 'url' => ['accounts/'], + 'url' => ['accounts/projects'], ], [ 'label' => 'Портфолио', - 'url' => ['accounts/portfolio-create'], + 'url' => ['accounts/portfolio'], ], [ 'label' => 'Блог', - 'url' => ['accounts/blog-create'], + 'url' => ['accounts/blog'], ], [ 'label' => 'Галерея', @@ -73,15 +73,15 @@ $this->beginContent('@app/views/layouts/main.php'); ], [ 'label' => 'Сообщения', - 'url' => ['accounts/'], + 'url' => ['chat/list'], ], [ 'label' => 'Уведомления о проектах', - 'url' => ['accounts/'], + 'url' => ['accounts/projects'], ], [ 'label' => 'Закладки', - 'url' => ['accounts/'], + 'url' => ['accounts/bookmarks'], ], [ 'label' => 'Настройка аккаунта', diff --git a/frontend/views/team/_form.php b/frontend/views/team/_form.php new file mode 100644 index 0000000..3782873 --- /dev/null +++ b/frontend/views/team/_form.php @@ -0,0 +1,39 @@ + + +
+ + + + field($model, 'firstname')->textInput(['maxlength' => true]) ?> + + field($model, 'lastname')->textInput(['maxlength' => true]) ?> + + field($model, 'middlename')->textInput(['maxlength' => true]) ?> + + field($model, 'link')->textInput(['maxlength' => true]) ?> + + field($model, 'position')->textInput(['maxlength' => true]) ?> + + field($model, 'department_id')->textInput() ?> + + field($model, 'photo')->textInput(['maxlength' => true]) ?> + + field($model, 'country_id')->textInput(['maxlength' => true]) ?> + + field($model, 'experience_from')->textInput() ?> + +
+ isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/frontend/views/team/_search.php b/frontend/views/team/_search.php new file mode 100644 index 0000000..32730dd --- /dev/null +++ b/frontend/views/team/_search.php @@ -0,0 +1,51 @@ + + + diff --git a/frontend/views/team/create.php b/frontend/views/team/create.php new file mode 100644 index 0000000..1dae188 --- /dev/null +++ b/frontend/views/team/create.php @@ -0,0 +1,21 @@ +title = Yii::t('app', 'Create Team'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Teams'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/frontend/views/team/index.php b/frontend/views/team/index.php new file mode 100644 index 0000000..dfc4e1a --- /dev/null +++ b/frontend/views/team/index.php @@ -0,0 +1,44 @@ +title = Yii::t('app', 'Teams'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ render('_search', ['model' => $searchModel]); ?> + +

+ 'btn btn-success']) ?> +

+ $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'team_id', + 'user_id', + 'firstname', + 'lastname', + 'middlename', + // 'link', + // 'position', + // 'department_id', + // 'date_add', + // 'user_add_id', + // 'photo', + // 'country_id', + // 'experience_from', + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> +
diff --git a/frontend/views/team/update.php b/frontend/views/team/update.php new file mode 100644 index 0000000..2308c4a --- /dev/null +++ b/frontend/views/team/update.php @@ -0,0 +1,23 @@ +title = Yii::t('app', 'Update {modelClass}: ', [ + 'modelClass' => 'Team', +]) . ' ' . $model->team_id; +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Teams'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->team_id, 'url' => ['view', 'id' => $model->team_id]]; +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/frontend/views/team/view.php b/frontend/views/team/view.php new file mode 100644 index 0000000..6c3e64b --- /dev/null +++ b/frontend/views/team/view.php @@ -0,0 +1,47 @@ +title = $model->team_id; +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Teams'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ $model->team_id], ['class' => 'btn btn-primary']) ?> + $model->team_id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'team_id', + 'user_id', + 'firstname', + 'lastname', + 'middlename', + 'link', + 'position', + 'department_id', + 'date_add', + 'user_add_id', + 'photo', + 'country_id', + 'experience_from', + ], + ]) ?> + +
-- libgit2 0.21.4