diff --git a/backend/controllers/AccountsController.php b/backend/controllers/AccountsController.php index 9f3c824..4511f1e 100644 --- a/backend/controllers/AccountsController.php +++ b/backend/controllers/AccountsController.php @@ -2,6 +2,8 @@ namespace backend\controllers; +use backend\models\Margins; +use backend\models\User; use common\models\DicCities; use Yii; use common\models\Accounts; @@ -65,13 +67,17 @@ class AccountsController extends Controller $model = new Accounts(); $cities = DicCities::find()->all(); + $margin = Margins::find()->all(); + $users = User::find()->all(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', [ + 'users' => $users, + 'margin' => $margin, 'cities' => $cities, - 'model' => $model, + 'model' => $model, ]); } } @@ -87,6 +93,8 @@ class AccountsController extends Controller $model = $this->findModel($id); $cities = DicCities::find()->all(); + $margin = Margins::find()->all(); + $users = User::find()->all(); $model->dt = date("Y.m.d" , $model->dt); @@ -94,8 +102,10 @@ class AccountsController extends Controller return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('update', [ + 'users' => $users, + 'margin' => $margin, 'cities' => $cities, - 'model' => $model, + 'model' => $model, ]); } } diff --git a/backend/models/Margins.php b/backend/models/Margins.php new file mode 100644 index 0000000..5f07c10 --- /dev/null +++ b/backend/models/Margins.php @@ -0,0 +1,48 @@ + 100], + [['name'], 'unique'] + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'name' => 'Name', + 'koef' => 'Koef', + ]; + } +} diff --git a/backend/models/User.php b/backend/models/User.php new file mode 100644 index 0000000..214cf20 --- /dev/null +++ b/backend/models/User.php @@ -0,0 +1,65 @@ + 255], + [['contacts'], 'string', 'max' => 100], + [['login'], 'unique'] + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'login' => 'Login', + 'password' => 'Password', + 'email' => 'Email', + 'is_super' => 'Is Super', + 'name' => 'Name', + 'office_id' => 'Office ID', + 'photo' => 'Photo', + 'contacts' => 'Contacts', + 'acl_accounts_access' => 'Acl Accounts Access', + 'active' => 'Active', + ]; + } +} diff --git a/backend/models/WAccounts.php b/backend/models/WAccounts.php new file mode 100644 index 0000000..2eb0601 --- /dev/null +++ b/backend/models/WAccounts.php @@ -0,0 +1,121 @@ + 150], + [['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'] + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => Yii::t('app', 'ID'), + 'if_manager' => Yii::t('app', 'If Manager'), + 'email' => Yii::t('app', 'Email'), + 'pass' => Yii::t('app', 'Pass'), + 'margin_id' => Yii::t('app', 'Margin ID'), + 'name' => Yii::t('app', 'Name'), + 'phones' => Yii::t('app', 'Phones'), + 'country' => Yii::t('app', 'Country'), + 'city' => Yii::t('app', 'City'), + 'address' => Yii::t('app', 'Address'), + 'comment' => Yii::t('app', 'Comment'), + 'rating' => Yii::t('app', 'Rating'), + 'dt' => Yii::t('app', 'Dt'), + 'is_active' => Yii::t('app', 'Is Active'), + 'is_firm' => Yii::t('app', 'Is Firm'), + 'last_loginin' => Yii::t('app', 'Last Loginin'), + 'firm_inn' => Yii::t('app', 'Firm Inn'), + 'firm_bank' => Yii::t('app', 'Firm Bank'), + 'balance' => Yii::t('app', 'Balance'), + 'office_id' => Yii::t('app', 'Office ID'), + 'is_scribe' => Yii::t('app', 'Is Scribe'), + 'set_manager_id' => Yii::t('app', 'Set Manager ID'), + 'phones2' => Yii::t('app', 'Phones2'), + 'phones3' => Yii::t('app', 'Phones3'), + 'car' => Yii::t('app', 'Car'), + 'mod' => Yii::t('app', 'Mod'), + 'snumb' => Yii::t('app', 'Snumb'), + 'deliveries' => Yii::t('app', 'Deliveries'), + '1scode' => Yii::t('app', '1scode'), + 'firm_ur_adr' => Yii::t('app', 'Firm Ur Adr'), + 'firm_fiz_adr' => Yii::t('app', 'Firm Fiz Adr'), + 'firm_code_eg' => Yii::t('app', 'Firm Code Eg'), + 'firm_rs' => Yii::t('app', 'Firm Rs'), + 'firm_mfo' => Yii::t('app', 'Firm Mfo'), + 'firm_site' => Yii::t('app', 'Firm Site'), + 'company' => Yii::t('app', 'Company'), + ]; + } +} diff --git a/backend/views/accounts/_form.php b/backend/views/accounts/_form.php index 8fe2b18..c9350ea 100644 --- a/backend/views/accounts/_form.php +++ b/backend/views/accounts/_form.php @@ -39,9 +39,10 @@ use yii\helpers\ArrayHelper; field($model, 'is_scribe')->checkbox() ?> - field($model, 'margin_id')->textInput() ?> - field($model, 'set_manager_id')->textInput() ?> + field($model, 'margin_id')->dropDownList(ArrayHelper::map($margin, 'id', 'name'), ['prompt' => 'Выберие город']) ?> + + field($model, 'set_manager_id')->dropDownList(ArrayHelper::map($users, 'id', 'name'), ['prompt' => 'Выберие город']) ?> field($model, 'scode')->textInput() ?> diff --git a/common/models/Accounts.php b/common/models/Accounts.php index 7ad6408..40fd7dc 100644 --- a/common/models/Accounts.php +++ b/common/models/Accounts.php @@ -107,9 +107,9 @@ class Accounts extends \yii\db\ActiveRecord 'phones3' => 'Телефоны 3', 'car' => Yii::t('app', 'Car'), 'mod' => Yii::t('app', 'Mod'), - 'snumb' => 'Код в 1С', + 'snumb' => 'snumb', 'deliveries' => Yii::t('app', 'Deliveries'), - 'scode' => Yii::t('app', 'Scode'), + 'scode' => 'Код в 1С', 'firm_ur_adr' => Yii::t('app', 'Firm Ur Adr'), 'firm_fiz_adr' => Yii::t('app', 'Firm Fiz Adr'), 'firm_code_eg' => Yii::t('app', 'Firm Code Eg'), diff --git a/common/models/WAccounts.php b/common/models/WAccounts.php deleted file mode 100644 index 7f601cf..0000000 --- a/common/models/WAccounts.php +++ /dev/null @@ -1,121 +0,0 @@ - 150], - [['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'] - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'id' => Yii::t('app', 'ID'), - 'if_manager' => Yii::t('app', 'If Manager'), - 'email' => Yii::t('app', 'Email'), - 'pass' => Yii::t('app', 'Pass'), - 'margin_id' => Yii::t('app', 'Margin ID'), - 'name' => Yii::t('app', 'Name'), - 'phones' => Yii::t('app', 'Phones'), - 'country' => Yii::t('app', 'Country'), - 'city' => Yii::t('app', 'City'), - 'address' => Yii::t('app', 'Address'), - 'comment' => Yii::t('app', 'Comment'), - 'rating' => Yii::t('app', 'Rating'), - 'dt' => Yii::t('app', 'Dt'), - 'is_active' => Yii::t('app', 'Is Active'), - 'is_firm' => Yii::t('app', 'Is Firm'), - 'last_loginin' => Yii::t('app', 'Last Loginin'), - 'firm_inn' => Yii::t('app', 'Firm Inn'), - 'firm_bank' => Yii::t('app', 'Firm Bank'), - 'balance' => Yii::t('app', 'Balance'), - 'office_id' => Yii::t('app', 'Office ID'), - 'is_scribe' => Yii::t('app', 'Is Scribe'), - 'set_manager_id' => Yii::t('app', 'Set Manager ID'), - 'phones2' => Yii::t('app', 'Phones2'), - 'phones3' => Yii::t('app', 'Phones3'), - 'car' => Yii::t('app', 'Car'), - 'mod' => Yii::t('app', 'Mod'), - 'snumb' => Yii::t('app', 'Snumb'), - 'deliveries' => Yii::t('app', 'Deliveries'), - 'scode' => Yii::t('app', 'Scode'), - 'firm_ur_adr' => Yii::t('app', 'Firm Ur Adr'), - 'firm_fiz_adr' => Yii::t('app', 'Firm Fiz Adr'), - 'firm_code_eg' => Yii::t('app', 'Firm Code Eg'), - 'firm_rs' => Yii::t('app', 'Firm Rs'), - 'firm_mfo' => Yii::t('app', 'Firm Mfo'), - 'firm_site' => Yii::t('app', 'Firm Site'), - 'company' => Yii::t('app', 'Company'), - ]; - } -} diff --git a/common/models/WAccountsSearch.php b/common/models/WAccountsSearch.php deleted file mode 100644 index b02eaeb..0000000 --- a/common/models/WAccountsSearch.php +++ /dev/null @@ -1,101 +0,0 @@ - $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, - 'if_manager' => $this->if_manager, - 'margin_id' => $this->margin_id, - 'country' => $this->country, - 'city' => $this->city, - 'rating' => $this->rating, - 'dt' => $this->dt, - 'is_active' => $this->is_active, - 'is_firm' => $this->is_firm, - 'balance' => $this->balance, - 'office_id' => $this->office_id, - 'is_scribe' => $this->is_scribe, - 'set_manager_id' => $this->set_manager_id, - 'car' => $this->car, - 'mod' => $this->mod, - 'deliveries' => $this->deliveries, - 'scode' => $this->scode, - ]); - - $query->andFilterWhere(['like', 'email', $this->email]) - ->andFilterWhere(['like', 'pass', $this->pass]) - ->andFilterWhere(['like', 'name', $this->name]) - ->andFilterWhere(['like', 'phones', $this->phones]) - ->andFilterWhere(['like', 'address', $this->address]) - ->andFilterWhere(['like', 'comment', $this->comment]) - ->andFilterWhere(['like', 'last_loginin', $this->last_loginin]) - ->andFilterWhere(['like', 'firm_inn', $this->firm_inn]) - ->andFilterWhere(['like', 'firm_bank', $this->firm_bank]) - ->andFilterWhere(['like', 'phones2', $this->phones2]) - ->andFilterWhere(['like', 'phones3', $this->phones3]) - ->andFilterWhere(['like', 'snumb', $this->snumb]) - ->andFilterWhere(['like', 'firm_ur_adr', $this->firm_ur_adr]) - ->andFilterWhere(['like', 'firm_fiz_adr', $this->firm_fiz_adr]) - ->andFilterWhere(['like', 'firm_code_eg', $this->firm_code_eg]) - ->andFilterWhere(['like', 'firm_rs', $this->firm_rs]) - ->andFilterWhere(['like', 'firm_mfo', $this->firm_mfo]) - ->andFilterWhere(['like', 'firm_site', $this->firm_site]) - ->andFilterWhere(['like', 'company', $this->company]); - - return $dataProvider; - } -} diff --git a/common/models/WDicCities.php b/common/models/WDicCities.php deleted file mode 100644 index 0305efc..0000000 --- a/common/models/WDicCities.php +++ /dev/null @@ -1,50 +0,0 @@ - 254], - [['parent', 'name'], 'unique', 'targetAttribute' => ['parent', 'name'], 'message' => 'The combination of Name and Parent has already been taken.'] - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'id' => Yii::t('app', 'ID'), - 'name' => Yii::t('app', 'Name'), - 'is_active' => Yii::t('app', 'Is Active'), - 'parent' => Yii::t('app', 'Parent'), - ]; - } -} -- libgit2 0.21.4