From 27ba995caa53402dfdcd636b8fb09d498d024bca Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 19 Nov 2015 13:08:52 +0200 Subject: [PATCH] access in admin --- backend/controllers/AccountsController.php | 2 +- backend/models/Accounts.php | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/Accounts.php | 2 +- 3 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 backend/models/Accounts.php diff --git a/backend/controllers/AccountsController.php b/backend/controllers/AccountsController.php index 26d1e63..8fc6c88 100755 --- a/backend/controllers/AccountsController.php +++ b/backend/controllers/AccountsController.php @@ -6,7 +6,7 @@ use backend\models\Margins; use backend\models\User; use common\models\DicCities; use Yii; -use common\models\Accounts; +use backend\models\Accounts; use common\models\AccountsSearch; use yii\web\Controller; diff --git a/backend/models/Accounts.php b/backend/models/Accounts.php new file mode 100644 index 0000000..1cb7f64 --- /dev/null +++ b/backend/models/Accounts.php @@ -0,0 +1,138 @@ +dt); + $this->dt = $date->getTimestamp(); + + } + + /** + * @inheritdoc + */ + public function rules() + { + return [ + [['if_manager', 'margin_id', 'country', 'city', 'rating', 'is_active', 'is_firm', 'office_id', 'is_scribe', 'set_manager_id', 'car', 'mod', 'deliveries', 'scode'], 'integer'], + [['email', 'pass', 'name','surname', 'phones',], 'required'], + [['comment'], 'string'], + [['balance'], 'number'], + [['email', 'name','surname', 'firm_site'], 'string', 'max' => 150], + [['pass','re_pass'], 'string', 'max' => 30], + [['phones', 'phones2', 'phones3'], 'string', 'max' => 50], + [['address', 'firm_inn', 'firm_bank'], 'string', 'max' => 254], + [['last_loginin'], 'string', 'max' => 15], + [['snumb', 'firm_ur_adr', 'firm_fiz_adr', 'firm_code_eg', 'firm_rs', 'firm_mfo', 'company'], 'string', 'max' => 255], + [['email'], 'unique'], + [['email'], 'email'], + ['re_pass', 'compare', 'compareAttribute' => 'pass'], + ['dt', 'date', 'format' => 'Y.m.d'] + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'if_manager' => 'Статус менеджера', + 'email' => 'E-mail (Логин)', + 'pass' => 'Пароль', + 'margin_id' => 'Тип цены', + 'name' => 'Имя', + 'phones' => 'Телефоны', + 'country' => Yii::t('app', 'Country'), + 'city' =>'Город', + 'address' => 'Адрес', + 'comment' => 'Комментарий', + 'rating' => Yii::t('app', 'Rating'), + 'dt' =>'Дата регистрации', + 'is_active' => 'Активный', + 'is_firm' => 'Юридическое лицо', + 'last_loginin' => Yii::t('app', 'Last Loginin'), + 'firm_inn' => 'ИНН', + 'firm_bank' => 'Банк', + 'balance' => Yii::t('app', 'Balance'), + 'office_id' => Yii::t('app', 'Office ID'), + 'is_scribe' => 'Подписка', + 'set_manager_id' => 'Персональный менеджер', + 'phones2' => 'Телефоны 2', + 'phones3' => 'Телефоны 3', + 'car' => Yii::t('app', 'Car'), + 'mod' => Yii::t('app', 'Mod'), + 'snumb' => 'snumb', + 'deliveries' => Yii::t('app', 'Deliveries'), + 'scode' => 'Код в 1С', + 'firm_ur_adr' => 'Юридический адрес', + 'firm_fiz_adr' => 'Физический адрес', + 'firm_code_eg' => 'Код ЭГ', + 'firm_rs' => 'Расчётный счёт', + 'firm_mfo' => 'МФО', + 'firm_site' => 'Сайт', + 'company' => 'Название фирмы', + ]; + } +} diff --git a/common/models/Accounts.php b/common/models/Accounts.php index 9f4fb7a..70dc2c5 100755 --- a/common/models/Accounts.php +++ b/common/models/Accounts.php @@ -75,7 +75,7 @@ class Accounts extends \yii\db\ActiveRecord { return [ [['if_manager', 'margin_id', 'country', 'city', 'rating', 'is_active', 'is_firm', 'office_id', 'is_scribe', 'set_manager_id', 'car', 'mod', 'deliveries', 'scode'], 'integer'], - [['email', 'pass', 'name','surname', 'phones',], 'required'], + [['company','email', 'pass', 'name','surname', 'phones',], 'required'], [['comment'], 'string'], [['balance'], 'number'], [['email', 'name','surname', 'firm_site'], 'string', 'max' => 150], -- libgit2 0.21.4