From fbd64ecb96e66c9d930156e84c2388de98771ed6 Mon Sep 17 00:00:00 2001
From: RedHood
Date: Wed, 13 Jan 2021 14:04:59 +1000
Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B0=D0=B7=D1=80=D0=B0=D0=B1=D0=BE?=
=?UTF-8?q?=D1=82=D0=BA=D0=B0=20=D0=B0=D1=80=D1=85=D0=B8=D1=82=D0=B5=D0=BA?=
=?UTF-8?q?=D1=82=D1=83=D1=80=D1=8B,=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8?=
=?UTF-8?q?=D0=BB=D1=8F,=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA?=
=?UTF-8?q?=D0=B8=20=D0=B8=D0=B7=20Excel=20=D0=B8=201C,=20=D0=BC=D0=BD?=
=?UTF-8?q?=D0=BE=D0=B3=D0=BE=20=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8=D1=85=20?=
=?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 4 +-
composer.json | 6 +-
composer.lock | 783 ++++++++++++++++--
mirzaev/skillparts/system/assets/.gitignore | 1 +
mirzaev/skillparts/system/assets/AppAsset.php | 4 +-
.../skillparts/system/config/test.php.example | 2 +-
.../skillparts/system/config/web.php.example | 45 +-
.../controllers/AuthenticationController.php | 93 +++
.../DeauthenticationController.php | 53 ++
.../system/controllers/ErrorController.php | 37 +
.../controllers/IdentificationController.php | 56 ++
.../system/controllers/MainController.php | 45 +
.../system/controllers/ProductController.php | 58 ++
.../system/controllers/ProfileController.php | 119 +++
.../controllers/RegistrationController.php | 97 +++
.../system/controllers/SiteController.php | 285 -------
...01219_074926_create_account_collection.php | 4 -
...10101_092505_create_product_collection.php | 16 +
...210107_163448_create_supply_collection.php | 16 +
..._create_account_edge_supply_collection.php | 16 +
...212826_create_product_group_collection.php | 16 +
..._product_edge_product_group_collection.php | 16 +
..._create_supply_edge_product_collection.php | 16 +
...create_product_edge_product_collection.php | 16 +
..._214817_create_supply_group_collection.php | 16 +
...te_supply_edge_supply_group_collection.php | 16 +
...5_create_supply_edge_supply_collection.php | 16 +
...ct_group_edge_product_group_collection.php | 16 +
...ply_group_edge_supply_group_collection.php | 16 +
...112_034135_create_requisite_collection.php | 16 +
...reate_supply_edge_requisite_collection.php | 16 +
...0113_021800_create_purchase_collection.php | 16 +
...reate_account_edge_purchase_collection.php | 16 +
...create_purchase_edge_supply_collection.php | 16 +
mirzaev/skillparts/system/models/Account.php | 140 ++--
.../system/models/AccountEdgePurchase.php | 11 +
.../system/models/AccountEdgeSupply.php | 11 +
.../skillparts/system/models/AccountForm.php | 91 +-
.../skillparts/system/models/ContactForm.php | 65 --
mirzaev/skillparts/system/models/Document.php | 49 ++
mirzaev/skillparts/system/models/Edge.php | 59 ++
mirzaev/skillparts/system/models/Product.php | 352 ++++++++
.../system/models/ProductEdgeProduct.php | 11 +
.../system/models/ProductEdgeProductGroup.php | 11 +
.../skillparts/system/models/ProductGroup.php | 175 ++++
.../models/ProductGroupEdgeProductGroup.php | 11 +
mirzaev/skillparts/system/models/Purchase.php | 80 ++
.../system/models/PurchaseEdgeSupply.php | 11 +
.../skillparts/system/models/Requisite.php | 49 ++
mirzaev/skillparts/system/models/Supply.php | 158 ++++
.../system/models/SupplyEdgeProduct.php | 11 +
.../system/models/SupplyEdgeRequisite.php | 11 +
.../system/models/SupplyEdgeSupply.php | 11 +
.../system/models/SupplyEdgeSupplyGroup.php | 11 +
.../skillparts/system/models/SupplyGroup.php | 42 +
.../models/SupplyGroupEdgeSupplyGroup.php | 11 +
mirzaev/skillparts/system/models/User.php | 104 ---
mirzaev/skillparts/system/views/account.php | 43 +
mirzaev/skillparts/system/views/error.php | 16 +
mirzaev/skillparts/system/views/index.php | 86 ++
.../skillparts/system/views/layouts/main.php | 126 ++-
.../skillparts/system/views/product/index.php | 18 +
.../skillparts/system/views/profile/index.php | 61 ++
.../skillparts/system/views/site/about.php | 18 -
.../skillparts/system/views/site/account.php | 34 -
.../skillparts/system/views/site/contact.php | 68 --
.../skillparts/system/views/site/error.php | 27 -
.../skillparts/system/views/site/index.php | 77 --
.../skillparts/system/views/site/profile.php | 63 --
mirzaev/skillparts/system/web/css/header.css | 16 +-
.../skillparts/system/web/css/info_panel.css | 15 +-
mirzaev/skillparts/system/web/css/main.css | 41 +-
mirzaev/skillparts/system/web/css/ticker.css | 4 +
.../system/web/img/logos/h100px/bomag.png | Bin 0 -> 3831 bytes
.../system/web/img/logos/h100px/case.png | Bin 0 -> 3272 bytes
.../web/img/logos/h100px/caterpillar.png | Bin 0 -> 5447 bytes
.../web/img/logos/h100px/compressed/bomag.png | Bin 0 -> 1369 bytes
.../web/img/logos/h100px/compressed/case.png | Bin 0 -> 1203 bytes
.../logos/h100px/compressed/caterpillar.png | Bin 0 -> 2177 bytes
.../img/logos/h100px/compressed/cummins.png | Bin 0 -> 895 bytes
.../img/logos/h100px/compressed/hitachi.png | Bin 0 -> 1081 bytes
.../web/img/logos/h100px/compressed/isuzu.png | Bin 0 -> 1060 bytes
.../web/img/logos/h100px/compressed/iveco.png | Bin 0 -> 1446 bytes
.../logos/h100px/compressed/john_deere.png | Bin 0 -> 2609 bytes
.../img/logos/h100px/compressed/kobelco.png | Bin 0 -> 1627 bytes
.../img/logos/h100px/compressed/komatsu.png | Bin 0 -> 1617 bytes
.../img/logos/h100px/compressed/perkins.png | Bin 0 -> 1872 bytes
.../img/logos/h100px/compressed/shantui.png | Bin 0 -> 1756 bytes
.../img/logos/h100px/compressed/shehwa.png | Bin 0 -> 2250 bytes
.../logos/h100px/compressed/skillparts.png | Bin 0 -> 1813 bytes
.../web/img/logos/h100px/compressed/xcmg.png | Bin 0 -> 1811 bytes
.../system/web/img/logos/h100px/cummins.png | Bin 0 -> 3692 bytes
.../system/web/img/logos/h100px/hitachi.png | Bin 0 -> 7431 bytes
.../system/web/img/logos/h100px/isuzu.png | Bin 0 -> 2864 bytes
.../system/web/img/logos/h100px/iveco.png | Bin 0 -> 4827 bytes
.../web/img/logos/h100px/john_deere.png | Bin 0 -> 9004 bytes
.../system/web/img/logos/h100px/kobelco.png | Bin 0 -> 7181 bytes
.../system/web/img/logos/h100px/komatsu.png | Bin 0 -> 6948 bytes
.../system/web/img/logos/h100px/perkins.png | Bin 0 -> 6734 bytes
.../system/web/img/logos/h100px/shantui.png | Bin 0 -> 4836 bytes
.../system/web/img/logos/h100px/shehwa.png | Bin 0 -> 9924 bytes
.../web/img/logos/h100px/skillparts.png | Bin 0 -> 7243 bytes
.../system/web/img/logos/h100px/xcmg.png | Bin 0 -> 8114 bytes
.../system/web/img/logos/john_deere.png | Bin 65593 -> 161343 bytes
.../system/web/img/logos/new_holland.svg | 3 +
.../system/web/img/logos/old/cummins.png | Bin 0 -> 6280 bytes
.../system/web/img/logos/old/john_deere.png | Bin 0 -> 65593 bytes
.../web/img/logos/{ => old}/new_holland.png | Bin
.../system/web/img/logos/skillparts.svg | 13 +
.../img/photos/compressed/963K_cutted.webp | Bin 0 -> 145188 bytes
mirzaev/skillparts/system/web/index.php | 4 +-
mirzaev/skillparts/system/web/js/account.js | 142 ++--
mirzaev/skillparts/system/web/js/menu.js | 106 +++
mirzaev/skillparts/system/web/js/profile.js | 35 +
.../system/web/js/reinitialization.js | 22 +-
mirzaev/skillparts/system/web/js/ticker.js | 26 +-
116 files changed, 3415 insertions(+), 1098 deletions(-)
create mode 100644 mirzaev/skillparts/system/assets/.gitignore
create mode 100644 mirzaev/skillparts/system/controllers/AuthenticationController.php
create mode 100644 mirzaev/skillparts/system/controllers/DeauthenticationController.php
create mode 100644 mirzaev/skillparts/system/controllers/ErrorController.php
create mode 100644 mirzaev/skillparts/system/controllers/IdentificationController.php
create mode 100644 mirzaev/skillparts/system/controllers/MainController.php
create mode 100644 mirzaev/skillparts/system/controllers/ProductController.php
create mode 100644 mirzaev/skillparts/system/controllers/ProfileController.php
create mode 100644 mirzaev/skillparts/system/controllers/RegistrationController.php
delete mode 100644 mirzaev/skillparts/system/controllers/SiteController.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210101_092505_create_product_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210107_163448_create_supply_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210108_014505_create_account_edge_supply_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210108_212826_create_product_group_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210108_221446_create_product_edge_product_group_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210108_222132_create_supply_edge_product_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210108_222740_create_product_edge_product_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210109_214817_create_supply_group_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210109_214833_create_supply_edge_supply_group_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210111_044635_create_supply_edge_supply_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210112_010347_create_product_group_edge_product_group_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210112_010411_create_supply_group_edge_supply_group_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210112_034135_create_requisite_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210112_034232_create_supply_edge_requisite_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210113_021800_create_purchase_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210113_021905_create_account_edge_purchase_collection.php
create mode 100644 mirzaev/skillparts/system/migrations/arangodb/m210113_021917_create_purchase_edge_supply_collection.php
create mode 100644 mirzaev/skillparts/system/models/AccountEdgePurchase.php
create mode 100644 mirzaev/skillparts/system/models/AccountEdgeSupply.php
delete mode 100644 mirzaev/skillparts/system/models/ContactForm.php
create mode 100644 mirzaev/skillparts/system/models/Document.php
create mode 100644 mirzaev/skillparts/system/models/Edge.php
create mode 100644 mirzaev/skillparts/system/models/Product.php
create mode 100644 mirzaev/skillparts/system/models/ProductEdgeProduct.php
create mode 100644 mirzaev/skillparts/system/models/ProductEdgeProductGroup.php
create mode 100644 mirzaev/skillparts/system/models/ProductGroup.php
create mode 100644 mirzaev/skillparts/system/models/ProductGroupEdgeProductGroup.php
create mode 100644 mirzaev/skillparts/system/models/Purchase.php
create mode 100644 mirzaev/skillparts/system/models/PurchaseEdgeSupply.php
create mode 100644 mirzaev/skillparts/system/models/Requisite.php
create mode 100644 mirzaev/skillparts/system/models/Supply.php
create mode 100644 mirzaev/skillparts/system/models/SupplyEdgeProduct.php
create mode 100644 mirzaev/skillparts/system/models/SupplyEdgeRequisite.php
create mode 100644 mirzaev/skillparts/system/models/SupplyEdgeSupply.php
create mode 100644 mirzaev/skillparts/system/models/SupplyEdgeSupplyGroup.php
create mode 100644 mirzaev/skillparts/system/models/SupplyGroup.php
create mode 100644 mirzaev/skillparts/system/models/SupplyGroupEdgeSupplyGroup.php
delete mode 100644 mirzaev/skillparts/system/models/User.php
create mode 100644 mirzaev/skillparts/system/views/account.php
create mode 100644 mirzaev/skillparts/system/views/error.php
create mode 100644 mirzaev/skillparts/system/views/index.php
create mode 100644 mirzaev/skillparts/system/views/product/index.php
create mode 100644 mirzaev/skillparts/system/views/profile/index.php
delete mode 100644 mirzaev/skillparts/system/views/site/about.php
delete mode 100644 mirzaev/skillparts/system/views/site/account.php
delete mode 100644 mirzaev/skillparts/system/views/site/contact.php
delete mode 100644 mirzaev/skillparts/system/views/site/error.php
delete mode 100644 mirzaev/skillparts/system/views/site/index.php
delete mode 100644 mirzaev/skillparts/system/views/site/profile.php
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/bomag.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/case.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/caterpillar.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/compressed/bomag.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/compressed/case.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/compressed/caterpillar.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/compressed/cummins.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/compressed/hitachi.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/compressed/isuzu.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/compressed/iveco.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/compressed/john_deere.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/compressed/kobelco.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/compressed/komatsu.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/compressed/perkins.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/compressed/shantui.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/compressed/shehwa.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/compressed/skillparts.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/compressed/xcmg.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/cummins.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/hitachi.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/isuzu.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/iveco.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/john_deere.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/kobelco.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/komatsu.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/perkins.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/shantui.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/shehwa.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/skillparts.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/h100px/xcmg.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/new_holland.svg
create mode 100644 mirzaev/skillparts/system/web/img/logos/old/cummins.png
create mode 100644 mirzaev/skillparts/system/web/img/logos/old/john_deere.png
rename mirzaev/skillparts/system/web/img/logos/{ => old}/new_holland.png (100%)
create mode 100644 mirzaev/skillparts/system/web/img/logos/skillparts.svg
create mode 100644 mirzaev/skillparts/system/web/img/photos/compressed/963K_cutted.webp
create mode 100644 mirzaev/skillparts/system/web/js/menu.js
create mode 100644 mirzaev/skillparts/system/web/js/profile.js
diff --git a/.gitignore b/.gitignore
index e851f6c..3a3b256 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
-vendor/
-cache/
\ No newline at end of file
+/vendor
+/cache
\ No newline at end of file
diff --git a/composer.json b/composer.json
index cadfc88..be7881a 100644
--- a/composer.json
+++ b/composer.json
@@ -21,7 +21,9 @@
"npm-asset/jquery": "^3.5",
"bower-asset/jquery": "^3.5",
"explosivebit/arangodb": "^2.0",
- "triagens/arangodb": "^3.6"
+ "triagens/arangodb": "^3.6",
+ "moonlandsoft/yii2-phpexcel": "^2.0",
+ "carono/yii2-1c-exchange": "^0.3.1"
},
"require-dev": {
"codeception/codeception": ">=4.1",
@@ -99,4 +101,4 @@
}
}
]
-}
\ No newline at end of file
+}
diff --git a/composer.lock b/composer.lock
index a13ca13..56b2099 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "d83ed7a25bd848237d6ae45b945471f6",
+ "content-hash": "88957d501cd6111bfb6987bd71d90524",
"packages": [
{
"name": "bower-asset/bootstrap",
@@ -32,7 +32,7 @@
"version": "3.3.11",
"source": {
"type": "git",
- "url": "git@github.com:RobinHerbots/Inputmask.git",
+ "url": "https://github.com/RobinHerbots/Inputmask.git",
"reference": "5e670ad62f50c738388d4dcec78d2888505ad77b"
},
"dist": {
@@ -53,7 +53,7 @@
"version": "3.5.1",
"source": {
"type": "git",
- "url": "https://github.com/jquery/jquery-dist.git",
+ "url": "git@github.com:jquery/jquery-dist.git",
"reference": "4c0e4becb8263bb5b3e6dadc448d8e7305ef8215"
},
"dist": {
@@ -71,7 +71,7 @@
"version": "v1.3.2",
"source": {
"type": "git",
- "url": "git@github.com:bestiejs/punycode.js.git",
+ "url": "https://github.com/bestiejs/punycode.js.git",
"reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3"
},
"dist": {
@@ -102,6 +102,102 @@
"MIT"
]
},
+ {
+ "name": "carono/commerceml",
+ "version": "0.2.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/carono/php-commerceml.git",
+ "reference": "9d357db9912ab680bc3932ba7c77a6dbb53c8e42"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/carono/php-commerceml/zipball/9d357db9912ab680bc3932ba7c77a6dbb53c8e42",
+ "reference": "9d357db9912ab680bc3932ba7c77a6dbb53c8e42",
+ "shasum": ""
+ },
+ "require": {
+ "ext-simplexml": "*"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Zenwalker\\CommerceML\\": "src/",
+ "Zenwalker\\CommerceML\\Tests\\": "tests/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Maxim Poletaev",
+ "email": "zenwalker2@gmail.com",
+ "homepage": "http://zenwalker.ru"
+ },
+ {
+ "name": "Aleksandr Kasyanov",
+ "email": "info@carono.ru",
+ "homepage": "http://carono.ru"
+ }
+ ],
+ "description": "Library for parsing CommerceML files",
+ "homepage": "https://github.com/zenwalker/php-commerceml",
+ "keywords": [
+ "1c",
+ "commerceml"
+ ],
+ "time": "2019-06-24T13:49:20+00:00"
+ },
+ {
+ "name": "carono/yii2-1c-exchange",
+ "version": "0.3.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/carono/yii2-1c-exchange.git",
+ "reference": "dce5af59ba5d6e6b86e33d824621dce2df77e056"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/carono/yii2-1c-exchange/zipball/dce5af59ba5d6e6b86e33d824621dce2df77e056",
+ "reference": "dce5af59ba5d6e6b86e33d824621dce2df77e056",
+ "shasum": ""
+ },
+ "require": {
+ "carono/commerceml": "^0.2.3",
+ "php": ">=5.6",
+ "yiisoft/yii2": "^2.0"
+ },
+ "require-dev": {
+ "yiidoc/yii2-redactor": "^2.0"
+ },
+ "type": "yii2-extension",
+ "extra": {
+ "bootstrap": "carono\\exchange1c\\Bootstrap"
+ },
+ "autoload": {
+ "psr-4": {
+ "carono\\exchange1c\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Aleksandr Kasyanov",
+ "email": "info@carono.ru",
+ "homepage": "http://carono.ru"
+ }
+ ],
+ "description": "Yii2 module for the exchange of goods and documents from 1C",
+ "time": "2020-09-08T12:58:28+00:00"
+ },
{
"name": "cebe/markdown",
"version": "1.2.1",
@@ -362,6 +458,339 @@
],
"time": "2020-06-29T00:56:53+00:00"
},
+ {
+ "name": "maennchen/zipstream-php",
+ "version": "2.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/maennchen/ZipStream-PHP.git",
+ "reference": "c4c5803cc1f93df3d2448478ef79394a5981cc58"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/c4c5803cc1f93df3d2448478ef79394a5981cc58",
+ "reference": "c4c5803cc1f93df3d2448478ef79394a5981cc58",
+ "shasum": ""
+ },
+ "require": {
+ "myclabs/php-enum": "^1.5",
+ "php": ">= 7.1",
+ "psr/http-message": "^1.0",
+ "symfony/polyfill-mbstring": "^1.0"
+ },
+ "require-dev": {
+ "ext-zip": "*",
+ "guzzlehttp/guzzle": ">= 6.3",
+ "mikey179/vfsstream": "^1.6",
+ "phpunit/phpunit": ">= 7.5"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "ZipStream\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Paul Duncan",
+ "email": "pabs@pablotron.org"
+ },
+ {
+ "name": "Jonatan Männchen",
+ "email": "jonatan@maennchen.ch"
+ },
+ {
+ "name": "Jesse Donat",
+ "email": "donatj@gmail.com"
+ },
+ {
+ "name": "András Kolesár",
+ "email": "kolesar@kolesar.hu"
+ }
+ ],
+ "description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.",
+ "keywords": [
+ "stream",
+ "zip"
+ ],
+ "funding": [
+ {
+ "url": "https://opencollective.com/zipstream",
+ "type": "open_collective"
+ }
+ ],
+ "time": "2020-05-30T13:11:16+00:00"
+ },
+ {
+ "name": "markbaker/complex",
+ "version": "2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/MarkBaker/PHPComplex.git",
+ "reference": "9999f1432fae467bc93c53f357105b4c31bb994c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/9999f1432fae467bc93c53f357105b4c31bb994c",
+ "reference": "9999f1432fae467bc93c53f357105b4c31bb994c",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.2 || ^8.0"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
+ "phpcompatibility/php-compatibility": "^9.0",
+ "phpdocumentor/phpdocumentor": "2.*",
+ "phploc/phploc": "^4.0",
+ "phpmd/phpmd": "2.*",
+ "phpunit/phpunit": "^7.0 || ^8.0 || ^9.3",
+ "sebastian/phpcpd": "^4.0",
+ "squizlabs/php_codesniffer": "^3.4"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Complex\\": "classes/src/"
+ },
+ "files": [
+ "classes/src/functions/abs.php",
+ "classes/src/functions/acos.php",
+ "classes/src/functions/acosh.php",
+ "classes/src/functions/acot.php",
+ "classes/src/functions/acoth.php",
+ "classes/src/functions/acsc.php",
+ "classes/src/functions/acsch.php",
+ "classes/src/functions/argument.php",
+ "classes/src/functions/asec.php",
+ "classes/src/functions/asech.php",
+ "classes/src/functions/asin.php",
+ "classes/src/functions/asinh.php",
+ "classes/src/functions/atan.php",
+ "classes/src/functions/atanh.php",
+ "classes/src/functions/conjugate.php",
+ "classes/src/functions/cos.php",
+ "classes/src/functions/cosh.php",
+ "classes/src/functions/cot.php",
+ "classes/src/functions/coth.php",
+ "classes/src/functions/csc.php",
+ "classes/src/functions/csch.php",
+ "classes/src/functions/exp.php",
+ "classes/src/functions/inverse.php",
+ "classes/src/functions/ln.php",
+ "classes/src/functions/log2.php",
+ "classes/src/functions/log10.php",
+ "classes/src/functions/negative.php",
+ "classes/src/functions/pow.php",
+ "classes/src/functions/rho.php",
+ "classes/src/functions/sec.php",
+ "classes/src/functions/sech.php",
+ "classes/src/functions/sin.php",
+ "classes/src/functions/sinh.php",
+ "classes/src/functions/sqrt.php",
+ "classes/src/functions/tan.php",
+ "classes/src/functions/tanh.php",
+ "classes/src/functions/theta.php",
+ "classes/src/operations/add.php",
+ "classes/src/operations/subtract.php",
+ "classes/src/operations/multiply.php",
+ "classes/src/operations/divideby.php",
+ "classes/src/operations/divideinto.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mark Baker",
+ "email": "mark@lange.demon.co.uk"
+ }
+ ],
+ "description": "PHP Class for working with complex numbers",
+ "homepage": "https://github.com/MarkBaker/PHPComplex",
+ "keywords": [
+ "complex",
+ "mathematics"
+ ],
+ "time": "2020-08-26T10:42:07+00:00"
+ },
+ {
+ "name": "markbaker/matrix",
+ "version": "2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/MarkBaker/PHPMatrix.git",
+ "reference": "9567d9c4c519fbe40de01dbd1e4469dbbb66f46a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/9567d9c4c519fbe40de01dbd1e4469dbbb66f46a",
+ "reference": "9567d9c4c519fbe40de01dbd1e4469dbbb66f46a",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.2 || ^8.0"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
+ "phpcompatibility/php-compatibility": "^9.0",
+ "phpdocumentor/phpdocumentor": "2.*",
+ "phploc/phploc": "^4.0",
+ "phpmd/phpmd": "2.*",
+ "phpunit/phpunit": "^7.0 || ^8.0 || ^9.3",
+ "sebastian/phpcpd": "^4.0",
+ "squizlabs/php_codesniffer": "^3.4"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Matrix\\": "classes/src/"
+ },
+ "files": [
+ "classes/src/functions/adjoint.php",
+ "classes/src/functions/antidiagonal.php",
+ "classes/src/functions/cofactors.php",
+ "classes/src/functions/determinant.php",
+ "classes/src/functions/diagonal.php",
+ "classes/src/functions/identity.php",
+ "classes/src/functions/inverse.php",
+ "classes/src/functions/minors.php",
+ "classes/src/functions/trace.php",
+ "classes/src/functions/transpose.php",
+ "classes/src/operations/add.php",
+ "classes/src/operations/directsum.php",
+ "classes/src/operations/subtract.php",
+ "classes/src/operations/multiply.php",
+ "classes/src/operations/divideby.php",
+ "classes/src/operations/divideinto.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mark Baker",
+ "email": "mark@demon-angel.eu"
+ }
+ ],
+ "description": "PHP Class for working with matrices",
+ "homepage": "https://github.com/MarkBaker/PHPMatrix",
+ "keywords": [
+ "mathematics",
+ "matrix",
+ "vector"
+ ],
+ "time": "2020-08-28T17:11:00+00:00"
+ },
+ {
+ "name": "moonlandsoft/yii2-phpexcel",
+ "version": "2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/moonlandsoft/yii2-phpexcel.git",
+ "reference": "e0614787a41a9e7e1c9ab3b707ce54c256461d7f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/moonlandsoft/yii2-phpexcel/zipball/e0614787a41a9e7e1c9ab3b707ce54c256461d7f",
+ "reference": "e0614787a41a9e7e1c9ab3b707ce54c256461d7f",
+ "shasum": ""
+ },
+ "require": {
+ "phpoffice/phpspreadsheet": "*",
+ "yiisoft/yii2": "*"
+ },
+ "type": "yii2-extension",
+ "autoload": {
+ "psr-4": {
+ "moonland\\phpexcel\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Moh Khoirul Anam",
+ "email": "moh.khoirul.anaam@gmail.com"
+ }
+ ],
+ "description": "Exporting PHP to Excel or Importing Excel to PHP",
+ "keywords": [
+ "excel",
+ "export",
+ "extension",
+ "import",
+ "xls",
+ "yii2"
+ ],
+ "time": "2018-10-27T03:52:57+00:00"
+ },
+ {
+ "name": "myclabs/php-enum",
+ "version": "1.7.7",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/myclabs/php-enum.git",
+ "reference": "d178027d1e679832db9f38248fcc7200647dc2b7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/myclabs/php-enum/zipball/d178027d1e679832db9f38248fcc7200647dc2b7",
+ "reference": "d178027d1e679832db9f38248fcc7200647dc2b7",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "php": ">=7.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7",
+ "squizlabs/php_codesniffer": "1.*",
+ "vimeo/psalm": "^3.8"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "MyCLabs\\Enum\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP Enum contributors",
+ "homepage": "https://github.com/myclabs/php-enum/graphs/contributors"
+ }
+ ],
+ "description": "PHP Enum implementation",
+ "homepage": "http://github.com/myclabs/php-enum",
+ "keywords": [
+ "enum"
+ ],
+ "funding": [
+ {
+ "url": "https://github.com/mnapoli",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/myclabs/php-enum",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-11-14T18:14:52+00:00"
+ },
{
"name": "npm-asset/jquery",
"version": "3.5.1",
@@ -374,6 +803,302 @@
"MIT"
]
},
+ {
+ "name": "phpoffice/phpspreadsheet",
+ "version": "1.16.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
+ "reference": "76d4323b85129d0c368149c831a07a3e258b2b50"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/76d4323b85129d0c368149c831a07a3e258b2b50",
+ "reference": "76d4323b85129d0c368149c831a07a3e258b2b50",
+ "shasum": ""
+ },
+ "require": {
+ "ext-ctype": "*",
+ "ext-dom": "*",
+ "ext-fileinfo": "*",
+ "ext-gd": "*",
+ "ext-iconv": "*",
+ "ext-libxml": "*",
+ "ext-mbstring": "*",
+ "ext-simplexml": "*",
+ "ext-xml": "*",
+ "ext-xmlreader": "*",
+ "ext-xmlwriter": "*",
+ "ext-zip": "*",
+ "ext-zlib": "*",
+ "ezyang/htmlpurifier": "^4.13",
+ "maennchen/zipstream-php": "^2.1",
+ "markbaker/complex": "^1.5||^2.0",
+ "markbaker/matrix": "^1.2||^2.0",
+ "php": "^7.2||^8.0",
+ "psr/http-client": "^1.0",
+ "psr/http-factory": "^1.0",
+ "psr/simple-cache": "^1.0"
+ },
+ "require-dev": {
+ "dompdf/dompdf": "^0.8.5",
+ "friendsofphp/php-cs-fixer": "^2.16",
+ "jpgraph/jpgraph": "^4.0",
+ "mpdf/mpdf": "^8.0",
+ "phpcompatibility/php-compatibility": "^9.3",
+ "phpunit/phpunit": "^8.5||^9.3",
+ "squizlabs/php_codesniffer": "^3.5",
+ "tecnickcom/tcpdf": "^6.3"
+ },
+ "suggest": {
+ "dompdf/dompdf": "Option for rendering PDF with PDF Writer (doesn't yet support PHP8)",
+ "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers",
+ "mpdf/mpdf": "Option for rendering PDF with PDF Writer",
+ "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer (doesn't yet support PHP8)"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Maarten Balliauw",
+ "homepage": "https://blog.maartenballiauw.be"
+ },
+ {
+ "name": "Mark Baker",
+ "homepage": "https://markbakeruk.net"
+ },
+ {
+ "name": "Franck Lefevre",
+ "homepage": "https://rootslabs.net"
+ },
+ {
+ "name": "Erik Tilt"
+ },
+ {
+ "name": "Adrien Crivelli"
+ }
+ ],
+ "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
+ "homepage": "https://github.com/PHPOffice/PhpSpreadsheet",
+ "keywords": [
+ "OpenXML",
+ "excel",
+ "gnumeric",
+ "ods",
+ "php",
+ "spreadsheet",
+ "xls",
+ "xlsx"
+ ],
+ "time": "2020-12-31T18:03:49+00:00"
+ },
+ {
+ "name": "psr/http-client",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-client.git",
+ "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
+ "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.0 || ^8.0",
+ "psr/http-message": "^1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Client\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP clients",
+ "homepage": "https://github.com/php-fig/http-client",
+ "keywords": [
+ "http",
+ "http-client",
+ "psr",
+ "psr-18"
+ ],
+ "time": "2020-06-29T06:28:15+00:00"
+ },
+ {
+ "name": "psr/http-factory",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-factory.git",
+ "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
+ "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.0.0",
+ "psr/http-message": "^1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interfaces for PSR-7 HTTP message factories",
+ "keywords": [
+ "factory",
+ "http",
+ "message",
+ "psr",
+ "psr-17",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "time": "2019-04-30T12:38:16+00:00"
+ },
+ {
+ "name": "psr/http-message",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-message.git",
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
+ "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP messages",
+ "homepage": "https://github.com/php-fig/http-message",
+ "keywords": [
+ "http",
+ "http-message",
+ "psr",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "time": "2016-08-06T14:39:51+00:00"
+ },
+ {
+ "name": "psr/simple-cache",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/simple-cache.git",
+ "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
+ "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\SimpleCache\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interfaces for simple caching",
+ "keywords": [
+ "cache",
+ "caching",
+ "psr",
+ "psr-16",
+ "simple-cache"
+ ],
+ "time": "2017-10-23T01:57:42+00:00"
+ },
{
"name": "swiftmailer/swiftmailer",
"version": "v6.2.4",
@@ -3146,56 +3871,6 @@
],
"time": "2019-01-08T18:20:26+00:00"
},
- {
- "name": "psr/http-message",
- "version": "1.0.1",
- "source": {
- "type": "git",
- "url": "https://github.com/php-fig/http-message.git",
- "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
- "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Psr\\Http\\Message\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "PHP-FIG",
- "homepage": "http://www.php-fig.org/"
- }
- ],
- "description": "Common interface for HTTP messages",
- "homepage": "https://github.com/php-fig/http-message",
- "keywords": [
- "http",
- "http-message",
- "psr",
- "psr-7",
- "request",
- "response"
- ],
- "time": "2016-08-06T14:39:51+00:00"
- },
{
"name": "ralouphie/getallheaders",
"version": "3.0.3",
diff --git a/mirzaev/skillparts/system/assets/.gitignore b/mirzaev/skillparts/system/assets/.gitignore
new file mode 100644
index 0000000..685f372
--- /dev/null
+++ b/mirzaev/skillparts/system/assets/.gitignore
@@ -0,0 +1 @@
+/import
\ No newline at end of file
diff --git a/mirzaev/skillparts/system/assets/AppAsset.php b/mirzaev/skillparts/system/assets/AppAsset.php
index 0984dc6..9aaaae4 100644
--- a/mirzaev/skillparts/system/assets/AppAsset.php
+++ b/mirzaev/skillparts/system/assets/AppAsset.php
@@ -27,7 +27,6 @@ class AppAsset extends AssetBundle
'css/header.css',
'css/info_panel.css',
'css/categories_blocks_panel.css',
- 'css/ticker.css',
'css/footer.css'
];
public $js = [
@@ -36,8 +35,9 @@ class AppAsset extends AssetBundle
'js/bootstrap/popper.min.js',
'js/bootstrap/bootstrap.min.js',
'https://cdn.jsdelivr.net/bxslider/4.1.1/jquery.bxslider.min.js',
+ 'https://unpkg.com/cookielib/src/cookie.min.js',
+ 'js/menu.js',
'js/account.js',
- 'js/ticker.js',
'js/reinitialization.js'
];
public $depends = [
diff --git a/mirzaev/skillparts/system/config/test.php.example b/mirzaev/skillparts/system/config/test.php.example
index 2165565..1081fdc 100644
--- a/mirzaev/skillparts/system/config/test.php.example
+++ b/mirzaev/skillparts/system/config/test.php.example
@@ -4,7 +4,7 @@
* Application configuration shared by all test types
*/
return [
- 'id' => 'basic-tests',
+ 'id' => 'skillparts-tests',
'basePath' => dirname(__DIR__),
'aliases' => [
'@bower' => '@vendor/bower-asset',
diff --git a/mirzaev/skillparts/system/config/web.php.example b/mirzaev/skillparts/system/config/web.php.example
index 3943420..bb36ea9 100644
--- a/mirzaev/skillparts/system/config/web.php.example
+++ b/mirzaev/skillparts/system/config/web.php.example
@@ -1,7 +1,7 @@
'basic',
+ 'id' => 'skillparts',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'aliases' => [
@@ -21,7 +21,8 @@ $config = [
],
'user' => [
'identityClass' => 'app\models\Account',
- 'enableAutoLogin' => true,
+ 'loginUrl' => ['/authentication'],
+ 'enableAutoLogin' => true
],
// 'session' => [
// 'class' => 'yii\web\Session',
@@ -30,7 +31,7 @@ $config = [
// 'useCookies' => true,
// ],
'errorHandler' => [
- 'errorAction' => 'site/error',
+ 'errorAction' => 'error',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
@@ -50,15 +51,32 @@ $config = [
],
'arangodb' => require __DIR__ . '/db.php',
'urlManager' => [
- 'enablePrettyUrl' => true,
- 'showScriptName' => false,
+ 'enablePrettyUrl' => true,
+ 'showScriptName' => false,
'rules' => [
- ['class' => 'yii\rest\UrlRule', 'controller' => 'site'],
- '' => 'site/'
+ [
+ 'class' => 'yii\rest\UrlRule',
+ 'controller' => 'main'
+ ],
+ 'product/' => 'product/index'
],
],
],
+ 'modules' => [
+ 'exchange' => [
+ 'class' => 'carono\exchange1c\ExchangeModule',
+ 'groupClass' => 'app\models\SupplyGroup',
+ 'productClass' => 'app\models\Supply',
+ 'offerClass' => 'app\models\Product',
+ 'partnerClass' => 'app\models\Account',
+ 'documentClass' => 'app\models\Purchase',
+ 'auth' => function ($mail, $pswd) {
+ // Необходимо уничтожить AccountForm
+ return (new \app\models\AccountForm())->authentication($mail, $pswd);
+ }
+ ]
+ ],
'params' => require __DIR__ . '/params.php',
];
@@ -70,17 +88,8 @@ if (YII_ENV_DEV) {
'ArangoDB' => [
'class' => 'explosivebit\arangodb\panels\arangodb\ArangoDbPanel'
]
- ],
- // uncomment the following to add your IP if you are not connecting from localhost.
- //'allowedIPs' => ['127.0.0.1', '::1'],
- ];
-
- $config['bootstrap'][] = 'gii';
- $config['modules']['gii'] = [
- 'class' => 'yii\gii\Module',
- // uncomment the following to add your IP if you are not connecting from localhost.
- //'allowedIPs' => ['127.0.0.1', '::1'],
+ ]
];
}
-return $config;
+return $config;
\ No newline at end of file
diff --git a/mirzaev/skillparts/system/controllers/AuthenticationController.php b/mirzaev/skillparts/system/controllers/AuthenticationController.php
new file mode 100644
index 0000000..c01fd83
--- /dev/null
+++ b/mirzaev/skillparts/system/controllers/AuthenticationController.php
@@ -0,0 +1,93 @@
+ [
+ 'class' => AccessControl::class,
+ 'rules' => [
+ [
+ 'allow' => true,
+ 'roles' => ['?'],
+ ]
+ ],
+ ]
+ ];
+ }
+
+ public function actionIndex()
+ {
+ if (Yii::$app->request->isAjax) {
+ // AJAX-POST-запрос
+
+ // Инициализация
+ $model = new AccountForm(Yii::$app->request->post('AccountForm'));
+ $model->scenario = $model::SCENARIO_AUTHENTICATION;
+
+ Yii::$app->response->format = Response::FORMAT_JSON;
+
+ if (!Yii::$app->user->isGuest || $model->authentication()) {
+ // Аккаунт аутентифицирован
+
+ // Запись ответа
+ $return = [
+ 'nav' => (new AccountForm())->deauthenticationGenHtml(),
+ '_csrf' => Yii::$app->request->getCsrfToken()
+ ];
+
+ if (($cookies = Yii::$app->request->cookies)->has('redirect')) {
+ // Найдено cookie с переадресацией
+
+ // Запись ответа
+ $return['redirect'] = '/' . $cookies['redirect'];
+ $return['main'] = $this->renderPartial($return['redirect'] . '/index');
+
+ // Очистка cookie
+ unset(Yii::$app->response->cookies['redirect']);
+ } else {
+ // Не найдено cookie с переадресацией
+
+ if (Yii::$app->request->pathInfo === 'authentication' || Yii::$app->request->pathInfo === 'registration') {
+ // Если клиент на промежуточном URI
+
+ // Запись ответа
+ $return['redirect'] = '/';
+ $return['main'] = $this->renderPartial('/index');
+ }
+ }
+
+ return $return;
+ } else {
+ // Аккаунт не аутентифицирован
+
+ Yii::$app->response->statusCode = 400;
+
+ return [
+ 'main' => $this->renderPartial('/account', compact('model')),
+ 'redirect' => '/authentication',
+ '_csrf' => Yii::$app->request->getCsrfToken()
+ ];
+ }
+ }
+
+ if (!Yii::$app->user->isGuest) {
+ Yii::$app->response->redirect('/');
+ } else {
+ return $this->render('/account');
+ }
+ }
+}
diff --git a/mirzaev/skillparts/system/controllers/DeauthenticationController.php b/mirzaev/skillparts/system/controllers/DeauthenticationController.php
new file mode 100644
index 0000000..8629794
--- /dev/null
+++ b/mirzaev/skillparts/system/controllers/DeauthenticationController.php
@@ -0,0 +1,53 @@
+ [
+ 'class' => AccessControl::class,
+ 'rules' => [
+ [
+ 'allow' => true,
+ 'roles' => ['@'],
+ ]
+ ],
+ ],
+ 'verbs' => [
+ 'class' => VerbFilter::class,
+ 'actions' => [
+ 'index' => ['post'],
+ ],
+ ]
+ ];
+ }
+
+ public function actionIndex()
+ {
+ Yii::$app->response->format = Response::FORMAT_JSON;
+
+ // Выход из аккаунта
+ Yii::$app->user->logout();
+
+ // Инициализация
+ $model = new AccountForm(Yii::$app->request->post('AccountForm') ?? Yii::$app->request->get('AccountForm') ?? null);
+
+ // Ответа
+ return [
+ 'nav' => $model->authenticationGenHtml($this->renderPartial('/account', compact('model'))),
+ 'main' => $this->renderPartial('/index'),
+ 'redirect' => '/',
+ '_csrf' => Yii::$app->request->getCsrfToken()
+ ];
+ }
+}
diff --git a/mirzaev/skillparts/system/controllers/ErrorController.php b/mirzaev/skillparts/system/controllers/ErrorController.php
new file mode 100644
index 0000000..c09ea5d
--- /dev/null
+++ b/mirzaev/skillparts/system/controllers/ErrorController.php
@@ -0,0 +1,37 @@
+errorHandler->exception;
+
+ if ($exception !== null) {
+ // Исключение не выброшено
+
+ // Запись кода ошибки
+ $statusCode = $exception->statusCode;
+
+ // Запись названия ошибки
+ $name = match ($exception->statusCode) {
+ 404 => '404 (Не найдено)',
+ default => $exception->getName()
+ };
+
+ // Запись сообщения об ошибке
+ $message = match ($exception->statusCode) {
+ 404 => 'Страница не найдена',
+ default => $exception->getMessage()
+ };
+
+ return $this->render('/error', compact('exception', 'statusCode', 'name', 'message'));
+ }
+ }
+}
diff --git a/mirzaev/skillparts/system/controllers/IdentificationController.php b/mirzaev/skillparts/system/controllers/IdentificationController.php
new file mode 100644
index 0000000..f5cf1bc
--- /dev/null
+++ b/mirzaev/skillparts/system/controllers/IdentificationController.php
@@ -0,0 +1,56 @@
+request->isAjax) {
+ // AJAX-POST-запрос
+
+ Yii::$app->response->format = Response::FORMAT_JSON;
+
+ if (Yii::$app->user->isGuest) {
+ // Аккаунт не аутентифицирован
+
+ // Инициализация
+ $model = new AccountForm(Yii::$app->request->post('AccountForm') ?? Yii::$app->request->get('AccountForm') ?? null);
+
+ // Запись ответа
+ $return = [
+ 'nav' => $model->authenticationGenHtml($this->renderPartial('/account', compact('model'))),
+ '_csrf' => Yii::$app->request->getCsrfToken()
+ ];
+ } else {
+ // Аккаунт аутентифицирован
+
+ // Инициализация
+ $model = Yii::$app->user;
+
+ // Запись ответа
+ $return = [
+ 'nav' => (new AccountForm())->deauthenticationGenHtml(),
+ '_csrf' => Yii::$app->request->getCsrfToken()
+ ];
+ }
+
+ if (($cookies = Yii::$app->request->cookies)->has('redirect')) {
+ // Найдено cookie с переадресацией
+
+ // Запись ответа
+ $return['redirect'] = '/' . $cookies['redirect'];
+
+ // Очистка cookie
+ unset(Yii::$app->response->cookies['redirect']);
+ }
+
+ return $return;
+ }
+ }
+}
diff --git a/mirzaev/skillparts/system/controllers/MainController.php b/mirzaev/skillparts/system/controllers/MainController.php
new file mode 100644
index 0000000..c6f71ef
--- /dev/null
+++ b/mirzaev/skillparts/system/controllers/MainController.php
@@ -0,0 +1,45 @@
+ [
+ 'class' => 'yii\captcha\CaptchaAction',
+ 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
+ ],
+ ];
+ }
+
+ /**
+ * Displays homepage.
+ *
+ * @return string
+ */
+ public function actionIndex()
+ {
+ if (Yii::$app->request->isAjax) {
+ // AJAX-POST-запрос
+
+ Yii::$app->response->format = Response::FORMAT_JSON;
+
+ return [
+ 'main' => $this->renderPartial('/index'),
+ 'redirect' => '/',
+ '_csrf' => Yii::$app->request->getCsrfToken()
+ ];
+ }
+
+ return $this->render('/index');
+ }
+}
diff --git a/mirzaev/skillparts/system/controllers/ProductController.php b/mirzaev/skillparts/system/controllers/ProductController.php
new file mode 100644
index 0000000..193300a
--- /dev/null
+++ b/mirzaev/skillparts/system/controllers/ProductController.php
@@ -0,0 +1,58 @@
+ [
+ 'class' => AccessControl::class,
+ 'only' => ['add'],
+ 'rules' => [
+ [
+ 'allow' => false,
+ 'roles' => ['?']
+ ]
+ ]
+ ]
+ ];
+ }
+
+ public function actionIndex(int $id)
+ {
+ if ($model = Product::readById($id)) {
+ // Товар найден
+
+ // Инициализация
+ $model = $model->getAttributes();
+
+ if (Yii::$app->request->isAjax) {
+ // AJAX-POST-запрос
+
+ Yii::$app->response->format = Response::FORMAT_JSON;
+
+ return [
+ 'main' => $this->renderPartial('index', compact('model')),
+ 'redirect' => '/product/' . $id,
+ '_csrf' => Yii::$app->request->getCsrfToken()
+ ];
+ }
+
+ return $this->render('index', compact('model'));
+ } else {
+ throw new HttpException(404);
+ }
+ }
+}
diff --git a/mirzaev/skillparts/system/controllers/ProfileController.php b/mirzaev/skillparts/system/controllers/ProfileController.php
new file mode 100644
index 0000000..5054382
--- /dev/null
+++ b/mirzaev/skillparts/system/controllers/ProfileController.php
@@ -0,0 +1,119 @@
+ [
+ 'class' => AccessControl::class,
+ 'rules' => [
+ [
+ 'allow' => true,
+ 'roles' => ['@']
+ ],
+ [
+ 'allow' => false,
+ 'roles' => ['?'],
+ 'verbs' => ['POST'],
+ 'denyCallback' => [$this, 'accessDenied']
+ ]
+ ]
+ ]
+ ];
+ }
+
+ public function accessDenied()
+ {
+ $cookies = Yii::$app->response->cookies;
+
+ $cookies->add(new Cookie([
+ 'name' => 'redirect',
+ 'value' => Yii::$app->request->pathInfo
+ ]));
+
+ Yii::$app->response->format = Response::FORMAT_JSON;
+
+ // Проверить переадресацию на уровне сервера
+ Yii::$app->response->content = json_encode([
+ 'main' => $this->renderPartial('/account'),
+ 'redirect' => '/authentication',
+ '_csrf' => Yii::$app->request->getCsrfToken()
+ ]);
+ }
+
+ public function actionIndex()
+ {
+ // Инициализация
+ $model = new Supply(Yii::$app->request->post('Supply') ?? Yii::$app->request->get('Supply'));
+
+ if (Yii::$app->request->isAjax) {
+ // AJAX-POST-запрос
+
+ Yii::$app->response->format = Response::FORMAT_JSON;
+
+ return [
+ 'main' => $this->renderPartial('index'),
+ 'redirect' => '/profile',
+ '_csrf' => Yii::$app->request->getCsrfToken()
+ ];
+ }
+
+ return $this->render('index', compact('model'));
+ }
+
+ public function actionImport()
+ {
+ // Инициализация
+ $model = new Supply(Yii::$app->request->post('Supply') ?? Yii::$app->request->get('Supply'));
+ $model->scenario = $model::SCENARIO_IMPORT;
+
+ if (Yii::$app->request->isAjax) {
+ // AJAX-POST-запрос
+
+ Yii::$app->response->format = Response::FORMAT_JSON;
+
+ $model->file = UploadedFile::getInstances($model, 'file');
+
+ if (!$test = $model->import()) {
+ Yii::$app->response->statusCode = 409;
+ }
+
+ return [
+ 'main' => $this->renderPartial('index', compact('model')),
+ '_csrf' => Yii::$app->request->getCsrfToken()
+ ];
+ }
+
+ return $this->render('index', compact('model'));
+ }
+
+ public static function readGroups()
+ {
+ // Инициализация
+ $groups = [];
+
+ foreach (SupplyGroup::readAll() as $group) {
+ // Перебор всех групп
+
+ // Генерация [КЛЮЧ => ИМЯ]
+ $groups[$group->_key] = $group->name;
+ }
+
+ return $groups;
+ }
+}
diff --git a/mirzaev/skillparts/system/controllers/RegistrationController.php b/mirzaev/skillparts/system/controllers/RegistrationController.php
new file mode 100644
index 0000000..4548ac2
--- /dev/null
+++ b/mirzaev/skillparts/system/controllers/RegistrationController.php
@@ -0,0 +1,97 @@
+ [
+ 'class' => AccessControl::class,
+ 'rules' => [
+ [
+ 'allow' => true,
+ 'roles' => ['?'],
+ ]
+ ],
+ ]
+ ];
+ }
+
+ public function actionIndex()
+ {
+ if (Yii::$app->request->isAjax) {
+ // AJAX-POST-запрос
+
+ // Инициализация
+ $model = new AccountForm(Yii::$app->request->post('AccountForm'));
+ $model->scenario = $model::SCENARIO_REGISTRATION;
+
+ Yii::$app->response->format = Response::FORMAT_JSON;
+
+ if (!Yii::$app->user->isGuest || $model->registration()) {
+ // Данные прошли проверку и аккаунт был создан
+
+ // Аутентификация
+ $model->scenario = $model::SCENARIO_AUTHENTICATION;
+ $model->authentication();
+
+ // Запись ответа
+ $return = [
+ 'nav' => (new AccountForm())->deauthenticationGenHtml(),
+ '_csrf' => Yii::$app->request->getCsrfToken()
+ ];
+
+ if (($cookies = Yii::$app->response->cookies)->has('redirect')) {
+ // Найдено cookie с переадресацией
+
+ // Запись ответа
+ $return['redirect'] = '/' . $cookies['redirect'];
+ $return['main'] = $this->renderPartial($return['redirect'] . '/index');
+
+ // Очистка cookie
+ unset(Yii::$app->response->cookies['redirect']);
+ } else {
+ // Не найдено cookie с переадресацией
+
+ if (Yii::$app->request->pathInfo === 'authentication' || Yii::$app->request->pathInfo === 'registration') {
+ // Если клиент на промежуточном URI
+
+ // Запись ответа
+ $return['redirect'] = '/';
+ $return['main'] = $this->renderPartial('/index');
+ }
+ }
+
+ return $return;
+ } else {
+ // Данные не прошли проверку
+
+ Yii::$app->response->statusCode = 400;
+
+ return [
+ 'main' => $this->renderPartial('/account', compact('model')),
+ 'redirect' => '/registration',
+ '_csrf' => Yii::$app->request->getCsrfToken()
+ ];
+ }
+ }
+
+ if (!Yii::$app->user->isGuest) {
+ Yii::$app->response->redirect('/');
+ } else {
+ return $this->render('/account', compact('model'));
+ }
+ }
+}
diff --git a/mirzaev/skillparts/system/controllers/SiteController.php b/mirzaev/skillparts/system/controllers/SiteController.php
deleted file mode 100644
index 1ff2c5d..0000000
--- a/mirzaev/skillparts/system/controllers/SiteController.php
+++ /dev/null
@@ -1,285 +0,0 @@
- [
- 'class' => AccessControl::class,
- 'only' => ['logout'],
- 'rules' => [
- [
- 'actions' => ['logout'],
- 'allow' => true,
- 'roles' => ['@'],
- ],
- ],
- ],
- 'verbs' => [
- 'class' => VerbFilter::class,
- 'actions' => [
- 'logout' => ['post'],
- ],
- ],
- ];
- }
-
- /**
- * {@inheritdoc}
- */
- public function actions()
- {
- return [
- 'error' => [
- 'class' => 'yii\web\ErrorAction',
- ],
- 'captcha' => [
- 'class' => 'yii\captcha\CaptchaAction',
- 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
- ],
- ];
- }
-
- /**
- * Displays homepage.
- *
- * @return string
- */
- public function actionIndex()
- {
- return $this->render('index');
- }
-
- /**
- * Identification action.
- *
- * @return Response
- */
- public function actionIdentification()
- {
- if (Yii::$app->request->isAjax) {
- Yii::$app->response->format = Response::FORMAT_JSON;
-
- if (Yii::$app->user->isGuest) {
- return [
- 'menu' => 'Вход',
- '_csrf' => Yii::$app->request->getCsrfToken()
- ];
- } else {
- $mail = Yii::$app->user->identity->mail;
-
- return [
- 'menu' => <<
-
-
- Выход ($mail)
-
- HTML,
- '_csrf' => Yii::$app->request->getCsrfToken()
- ];
- }
- }
- }
-
- /**
- * Login action.
- *
- * @return Response|string
- */
- public function actionAuthentication()
- {
- $model = new AccountForm(Yii::$app->request->post()['AccountForm'] ?? Yii::$app->request->get()['AccountForm'] ?? null);
-
- if (Yii::$app->request->isAjax) {
- // AJAX-POST-запрос
-
- Yii::$app->response->format = Response::FORMAT_JSON;
-
- if (!Yii::$app->user->isGuest) {
- // Аккаунт уже аутентифицирован
- Yii::$app->response->statusCode = 403;
- return [
- 'form' => $this->renderPartial('index'),
- '_csrf' => Yii::$app->request->getCsrfToken()
- ];
- }
-
- if ($model->authentication()) {
- // Данные прошли проверку
-
- return [
- 'menu' => <<
-
-
- Выход ($model->mail)
-
- HTML,
- 'form' => $this->renderPartial('index'),
- '_csrf' => Yii::$app->request->getCsrfToken()
- ];
- } else {
- // Данные не прошли проверку
-
- Yii::$app->response->statusCode = 400;
-
- return [
- 'form' => $this->renderPartial('account', compact('model')),
- '_csrf' => Yii::$app->request->getCsrfToken()
- ];
- }
- } else if (Yii::$app->request->isPost) {
- // POST-запрос
- } else {
- // GET-запрос и прочие
-
- if (!Yii::$app->user->isGuest) {
- // Аккаунт уже аутентифицирован
- Yii::$app->response->redirect('/');
- }
- }
-
- return $this->render('authentication', compact('model'));
- }
-
- /**
- * Logout action.
- *
- * @return Response
- */
- public function actionDeauthentication()
- {
- if (Yii::$app->request->isAjax) {
- // AJAX-POST-запрос
-
- Yii::$app->response->format = Response::FORMAT_JSON;
- Yii::$app->user->logout();
-
- return [
- 'menu' => 'Вход',
- '_csrf' => Yii::$app->request->getCsrfToken()
- ];
- }
-
- Yii::$app->response->redirect('/');
- }
-
- /**
- * Login action.
- *
- * @return Response|string
- */
- public function actionRegistration()
- {
- $model = new AccountForm(Yii::$app->request->post()['AccountForm'] ?? Yii::$app->request->get()['AccountForm'] ?? null);
- $model->type = 0;
-
- if (Yii::$app->request->isAjax) {
- // AJAX-POST-запрос
-
- Yii::$app->response->format = Response::FORMAT_JSON;
-
- if (!Yii::$app->user->isGuest) {
- // Аккаунт уже аутентифицирован
- Yii::$app->response->statusCode = 302;
- return [
- 'form' => $this->renderPartial('index'),
- '_csrf' => Yii::$app->request->getCsrfToken()
- ];
- }
-
- if ($model->registration()) {
- // Данные прошли проверку и аккаунт был создан
-
- return [
- 'menu' => <<
-
-
- Выход ($model->mail)
-
- HTML,
- 'form' => $this->renderPartial('index'),
- '_csrf' => Yii::$app->request->getCsrfToken()
- ];
- } else {
- // Данные не прошли проверку
-
- Yii::$app->response->statusCode = 400;
-
- return [
- 'form' => $this->renderPartial('account', compact('model')),
- '_csrf' => Yii::$app->request->getCsrfToken()
- ];
- }
- } else if (Yii::$app->request->isPost) {
- // POST-запрос
- return;
- } else {
- // GET-запрос и прочие
-
- if (!Yii::$app->user->isGuest) {
- // Аккаунт уже аутентифицирован
- Yii::$app->response->redirect('/');
- }
- }
-
- return $this->render('registration', compact('model'));
- }
-
- /**
- * Displays профиль
- *
- * @return Response|string
- */
- public function actionProfile()
- {
- $model = new Account();
-
- return $this->render('profile', compact('model'));
- }
-
- /**
- * Displays contact page.
- *
- * @return Response|string
- */
- public function actionContact()
- {
- $model = new ContactForm();
- if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
- Yii::$app->session->setFlash('contactFormSubmitted');
-
- return $this->refresh();
- }
- return $this->render('contact', [
- 'model' => $model,
- ]);
- }
-
- /**
- * Displays about page.
- *
- * @return string
- */
- public function actionAbout()
- {
- return $this->render('about');
- }
-}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m201219_074926_create_account_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m201219_074926_create_account_collection.php
index f35cb13..2807e43 100644
--- a/mirzaev/skillparts/system/migrations/arangodb/m201219_074926_create_account_collection.php
+++ b/mirzaev/skillparts/system/migrations/arangodb/m201219_074926_create_account_collection.php
@@ -11,10 +11,6 @@ class m201219_074926_create_account_collection extends Migration
public function down()
{
- // $this->delete('accounts', 'mail');
- // $this->delete('accounts', 'name');
- // $this->delete('accounts', 'pswd');
-
$this->dropCollection('account');
}
}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210101_092505_create_product_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210101_092505_create_product_collection.php
new file mode 100644
index 0000000..6c02fa4
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210101_092505_create_product_collection.php
@@ -0,0 +1,16 @@
+createCollection('product');
+ }
+
+ public function down()
+ {
+ $this->dropCollection('product');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210107_163448_create_supply_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210107_163448_create_supply_collection.php
new file mode 100644
index 0000000..00a7ddd
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210107_163448_create_supply_collection.php
@@ -0,0 +1,16 @@
+createCollection('supply');
+ }
+
+ public function down()
+ {
+ $this->dropCollection('supply');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210108_014505_create_account_edge_supply_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210108_014505_create_account_edge_supply_collection.php
new file mode 100644
index 0000000..6915e1a
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210108_014505_create_account_edge_supply_collection.php
@@ -0,0 +1,16 @@
+createCollection('account_edge_supply', ['Type' => 3]);
+ }
+
+ public function down()
+ {
+ $this->dropCollection('account_edge_supply');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210108_212826_create_product_group_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210108_212826_create_product_group_collection.php
new file mode 100644
index 0000000..46fd6ee
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210108_212826_create_product_group_collection.php
@@ -0,0 +1,16 @@
+createCollection('product_group');
+ }
+
+ public function down()
+ {
+ $this->dropCollection('product_group');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210108_221446_create_product_edge_product_group_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210108_221446_create_product_edge_product_group_collection.php
new file mode 100644
index 0000000..2f1da81
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210108_221446_create_product_edge_product_group_collection.php
@@ -0,0 +1,16 @@
+createCollection('product_edge_product_group', ['Type' => 3]);
+ }
+
+ public function down()
+ {
+ $this->dropCollection('product_edge_product_group');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210108_222132_create_supply_edge_product_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210108_222132_create_supply_edge_product_collection.php
new file mode 100644
index 0000000..2b802e0
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210108_222132_create_supply_edge_product_collection.php
@@ -0,0 +1,16 @@
+createCollection('supply_edge_product', ['Type' => 3]);
+ }
+
+ public function down()
+ {
+ $this->dropCollection('supply_edge_product');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210108_222740_create_product_edge_product_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210108_222740_create_product_edge_product_collection.php
new file mode 100644
index 0000000..b5ffe84
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210108_222740_create_product_edge_product_collection.php
@@ -0,0 +1,16 @@
+createCollection('product_edge_product', ['Type' => 3]);
+ }
+
+ public function down()
+ {
+ $this->dropCollection('product_edge_product');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210109_214817_create_supply_group_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210109_214817_create_supply_group_collection.php
new file mode 100644
index 0000000..e882a7f
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210109_214817_create_supply_group_collection.php
@@ -0,0 +1,16 @@
+createCollection('supply_group');
+ }
+
+ public function down()
+ {
+ $this->dropCollection('supply_group');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210109_214833_create_supply_edge_supply_group_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210109_214833_create_supply_edge_supply_group_collection.php
new file mode 100644
index 0000000..7632894
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210109_214833_create_supply_edge_supply_group_collection.php
@@ -0,0 +1,16 @@
+createCollection('supply_edge_supply_group', ['Type' => 3]);
+ }
+
+ public function down()
+ {
+ $this->dropCollection('supply_edge_supply_group');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210111_044635_create_supply_edge_supply_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210111_044635_create_supply_edge_supply_collection.php
new file mode 100644
index 0000000..5245019
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210111_044635_create_supply_edge_supply_collection.php
@@ -0,0 +1,16 @@
+createCollection('supply_edge_supply', ['Type' => 3]);
+ }
+
+ public function down()
+ {
+ $this->dropCollection('supply_edge_supply');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210112_010347_create_product_group_edge_product_group_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210112_010347_create_product_group_edge_product_group_collection.php
new file mode 100644
index 0000000..0f4b7a2
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210112_010347_create_product_group_edge_product_group_collection.php
@@ -0,0 +1,16 @@
+createCollection('product_group_edge_product_group', ['Type' => 3]);
+ }
+
+ public function down()
+ {
+ $this->dropCollection('product_group_edge_product_group');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210112_010411_create_supply_group_edge_supply_group_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210112_010411_create_supply_group_edge_supply_group_collection.php
new file mode 100644
index 0000000..304f041
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210112_010411_create_supply_group_edge_supply_group_collection.php
@@ -0,0 +1,16 @@
+createCollection('supply_group_edge_supply_group', ['Type' => 3]);
+ }
+
+ public function down()
+ {
+ $this->dropCollection('supply_group_edge_supply_group');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210112_034135_create_requisite_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210112_034135_create_requisite_collection.php
new file mode 100644
index 0000000..d8c0c22
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210112_034135_create_requisite_collection.php
@@ -0,0 +1,16 @@
+createCollection('requisite');
+ }
+
+ public function down()
+ {
+ $this->dropCollection('requisite');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210112_034232_create_supply_edge_requisite_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210112_034232_create_supply_edge_requisite_collection.php
new file mode 100644
index 0000000..8df395f
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210112_034232_create_supply_edge_requisite_collection.php
@@ -0,0 +1,16 @@
+createCollection('supply_edge_requisite', ['Type' => 3]);
+ }
+
+ public function down()
+ {
+ $this->dropCollection('supply_edge_requisite');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210113_021800_create_purchase_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210113_021800_create_purchase_collection.php
new file mode 100644
index 0000000..2f303e8
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210113_021800_create_purchase_collection.php
@@ -0,0 +1,16 @@
+createCollection('purchase');
+ }
+
+ public function down()
+ {
+ $this->dropCollection('purchase');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210113_021905_create_account_edge_purchase_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210113_021905_create_account_edge_purchase_collection.php
new file mode 100644
index 0000000..1f3e83c
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210113_021905_create_account_edge_purchase_collection.php
@@ -0,0 +1,16 @@
+createCollection('account_edge_purchase', ['Type' => 3]);
+ }
+
+ public function down()
+ {
+ $this->dropCollection('account_edge_purchase');
+ }
+}
diff --git a/mirzaev/skillparts/system/migrations/arangodb/m210113_021917_create_purchase_edge_supply_collection.php b/mirzaev/skillparts/system/migrations/arangodb/m210113_021917_create_purchase_edge_supply_collection.php
new file mode 100644
index 0000000..51ae0c8
--- /dev/null
+++ b/mirzaev/skillparts/system/migrations/arangodb/m210113_021917_create_purchase_edge_supply_collection.php
@@ -0,0 +1,16 @@
+createCollection('purchase_edge_supply', ['Type' => 3]);
+ }
+
+ public function down()
+ {
+ $this->dropCollection('purchase_edge_supply');
+ }
+}
diff --git a/mirzaev/skillparts/system/models/Account.php b/mirzaev/skillparts/system/models/Account.php
index 9126749..6cb5ee4 100644
--- a/mirzaev/skillparts/system/models/Account.php
+++ b/mirzaev/skillparts/system/models/Account.php
@@ -4,91 +4,106 @@ namespace app\models;
use Yii;
use yii\web\IdentityInterface;
-use explosivebit\arangodb\ActiveRecord;
+use carono\exchange1c\interfaces\PartnerInterface;
-class Account extends ActiveRecord implements IdentityInterface
+class Account extends Document implements IdentityInterface, PartnerInterface
{
- public $_mail;
- public $_pswd;
- public $_name;
- public $_simc;
- public $_sity;
- public $_comp;
- public $_taxn;
- public $_auth;
-
- /**
- * @return string the name of the index associated with this ActiveRecord class.
- */
public static function collectionName()
{
return 'account';
}
- /**
- * @return array list of attribute names.
- */
public function attributes()
{
- return ['mail', 'pswd', 'auth', 'name' => 'sex', 'simc', 'sity', 'comp', 'taxn', 'auth'];
+ return array_merge(
+ parent::attributes(),
+ ['mail', 'pswd', 'name', 'simc', 'sity', 'comp', 'taxn', 'auth']
+ );
+ }
+
+ public function rules()
+ {
+ return array_merge(
+ parent::rules(),
+ [
+ [['mail', 'pswd'], 'required', 'message' => 'Заполните поле'],
+ ['mail', 'email'],
+ [['mail', 'comp', 'simc'], 'unique', 'message' => '2']
+ ]
+ );
+ }
+
+ public function attributeLabels()
+ {
+ return array_merge(
+ parent::attributeLabels(),
+ [
+ 'mail' => 'Почта',
+ 'pswd' => 'Пароль',
+ 'name' => 'Имя',
+ 'simc' => 'Номер',
+ 'sity' => 'Город',
+ 'comp' => 'Компания',
+ 'taxn' => 'ИНН',
+ 'auth' => 'Аутентификационный хеш'
+ ]
+ );
+ }
+
+ public function beforeSave($data)
+ {
+ if (parent::beforeSave($data)) {
+ if ($this->isNewRecord) {
+ $this->auth = Yii::$app->security->generateRandomString();
+ }
+
+ return true;
+ }
+ return false;
+ }
+
+ public function getExportFields1c($context = null)
+ {
+ return [
+ 'Ид' => 'id',
+ 'Наименование' => 'username',
+ 'ПолноеНаименование' => 'full_name',
+ 'Фамилия' => 'surname',
+ 'Имя' => 'name',
+ ];
}
- /**
- * @return int|string current user ID
- */
public function getId()
{
- return $this->mail;
+ return $this->_key;
}
- /**
- * @return string current user auth key
- */
public function getAuthKey()
{
return $this->auth;
}
- /**
- * Finds an identity by the given ID.
- *
- * @param string|int $id the ID to be looked for
- * @return IdentityInterface|null the identity object that matches the given ID.
- */
- public static function findIdentity($mail)
+ public static function findIdentity($_key)
{
- return static::findByMail($mail);
+ return static::findByKey($_key);
}
- /**
- * Finds an identity by the given token.
- *
- * @param string $token the token to be looked for
- * @return IdentityInterface|null the identity object that matches the given token.
- */
public static function findIdentityByAccessToken($pass, $type = null)
{
return static::findOne(['pass' => $pass]);
}
- /**
- * Finds user by mail
- *
- * @param string $mail
- * @return static|null
- */
public static function findByMail($mail)
{
return static::findOne(['mail' => $mail]);
}
- /**
- * Validates mail
- *
- * @param string $pswd password to validate
- * @return bool if password provided is valid for current user
- */
- public function validateMail($mail)
+ public static function findByKey($_key)
+ {
+ return static::findOne(['_key' => $_key]);
+ }
+
+ public static function validateMail($mail)
{
if (static::findByMail($mail)) {
// Почта найдена в базе данных
@@ -99,34 +114,13 @@ class Account extends ActiveRecord implements IdentityInterface
return true;
}
- /**
- * Validates password
- *
- * @param string $pswd password to validate
- * @return bool if password provided is valid for current user
- */
public function validatePassword($pswd)
{
return Yii::$app->security->validatePassword($pswd, $this->pswd);
}
- /**
- * @param string $auth
- * @return bool if auth key is valid for current user
- */
public function validateAuthKey($auth)
{
return $this->getAuthKey() === $auth;
}
-
- public function beforeSave($insert)
- {
- if (parent::beforeSave($insert)) {
- if ($this->isNewRecord) {
- $this->auth = Yii::$app->security->generateRandomString();
- }
- return true;
- }
- return false;
- }
}
diff --git a/mirzaev/skillparts/system/models/AccountEdgePurchase.php b/mirzaev/skillparts/system/models/AccountEdgePurchase.php
new file mode 100644
index 0000000..df61424
--- /dev/null
+++ b/mirzaev/skillparts/system/models/AccountEdgePurchase.php
@@ -0,0 +1,11 @@
+ 'Заполните поле'],
// Функция "Запомнить меня"
- ['auto', 'boolean'],
- // Проверка почты
- ['mail', 'validateMail', 'message'=>'Неправильная почта'],
+ ['auto', 'boolean', 'on' => self::SCENARIO_AUTHENTICATION],
+ // Проверка почты,
+ ['mail', 'email', 'message' => 'Проверьте почту'],
+ ['mail', 'validateMail', 'on' => self::SCENARIO_REGISTRATION],
// Проверка пароля
- ['pswd', 'validatePassword', 'message'=>'Неправильный пароль'],
+ ['pswd', 'validatePassword', 'on' => self::SCENARIO_AUTHENTICATION]
];
}
@@ -53,38 +45,28 @@ class AccountForm extends Model
return [
'mail' => 'Почта',
'pswd' => 'Пароль',
- 'auto' => 'Запомнить'
+ 'auto' => ''
];
}
- /**
- * @param string $attribute the attribute currently being validated
- * @param array $params the additional name-value pairs given in the rule
- */
public function validateMail($attribute, $params)
{
- if (!$this->hasErrors() && $this->type === 0) {
+ if (!$this->hasErrors()) {
// Проблем нет, обрабатывается событие регистрации
$account = $this->getAccount();
if (!$account || !$account->validateMail($this->mail)) {
// Проверка не пройдена
- $this->addError($attribute, 'Почта уже привязана к другому аккаунту');
+
+ $this->addError($attribute, 'Почта уже привязана');
}
}
}
- /**
- * Validates the password.
- * This method serves as the inline validation for password.
- *
- * @param string $attribute the attribute currently being validated
- * @param array $params the additional name-value pairs given in the rule
- */
public function validatePassword($attribute, $params)
{
- if (!$this->hasErrors() && $this->type === 1) {
+ if (!$this->hasErrors()) {
// Проблем нет, обрабатывается событие аутентификации
$account = $this->getAccount();
@@ -92,7 +74,7 @@ class AccountForm extends Model
if (!$account || !$account->validatePassword($this->pswd)) {
// Проверка не пройдена
- $this->addError($attribute, 'Проверьте входные данные');
+ $this->addError($attribute, 'Проверьте пароль');
}
}
}
@@ -101,13 +83,18 @@ class AccountForm extends Model
* Logs in a account using the provided accountname and password.
* @return bool whether the account is logged in successfully
*/
- public function authentication()
+ public function authentication(string $mail = null, string $pswd = null)
{
+ if (isset($mail, $pswd)) {
+ $this->mail = $mail;
+ $this->pswd = $pswd;
+ }
+
if (isset($this->mail, $this->pswd) && $this->validate()) {
// Проверка пройдена
// Аутентификация
- return Yii::$app->user->login($this->getAccount(), $this->auto ? 3600*24*30 : 0);
+ return Yii::$app->user->login($this->getAccount(), $this->auto ? 3600 * 24 * 30 : 0);
}
return false;
@@ -148,4 +135,38 @@ class AccountForm extends Model
return $this->account;
}
+
+ public function authenticationGenHtml(string $dropdown): string
+ {
+ return <<
+
+
+ HTML;
+ }
+
+ public function deauthenticationGenHtml(): string
+ {
+ $mail = Yii::$app->user->identity->mail;
+
+ return <<
+
+
+ HTML;
+ }
}
diff --git a/mirzaev/skillparts/system/models/ContactForm.php b/mirzaev/skillparts/system/models/ContactForm.php
deleted file mode 100644
index f001d21..0000000
--- a/mirzaev/skillparts/system/models/ContactForm.php
+++ /dev/null
@@ -1,65 +0,0 @@
- 'Verification Code',
- ];
- }
-
- /**
- * Sends an email to the specified email address using the information collected by this model.
- * @param string $email the target email address
- * @return bool whether the model passes validation
- */
- public function contact($email)
- {
- if ($this->validate()) {
- Yii::$app->mailer->compose()
- ->setTo($email)
- ->setFrom([Yii::$app->params['senderEmail'] => Yii::$app->params['senderName']])
- ->setReplyTo([$this->email => $this->name])
- ->setSubject($this->subject)
- ->setTextBody($this->body)
- ->send();
-
- return true;
- }
- return false;
- }
-}
diff --git a/mirzaev/skillparts/system/models/Document.php b/mirzaev/skillparts/system/models/Document.php
new file mode 100644
index 0000000..1b48a67
--- /dev/null
+++ b/mirzaev/skillparts/system/models/Document.php
@@ -0,0 +1,49 @@
+ 'Заполните поле: {attribute}'
+ // ]
+ ];
+ }
+
+ public function attributeLabels()
+ {
+ return [
+ 'date' => 'Дата'
+ ];
+ }
+
+ public function beforeSave($data)
+ {
+ if (parent::beforeSave($data)) {
+ if ($this->isNewRecord) {
+ $this->date = time();
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public static function readAmount()
+ {
+ return static::find()->count();
+ }
+}
diff --git a/mirzaev/skillparts/system/models/Edge.php b/mirzaev/skillparts/system/models/Edge.php
new file mode 100644
index 0000000..e358c3d
--- /dev/null
+++ b/mirzaev/skillparts/system/models/Edge.php
@@ -0,0 +1,59 @@
+ 'Заполните поле: {attribute}'
+ ],
+ [
+ 'date',
+ 'integer'
+ ],
+ [
+ 'type',
+ 'string'
+ ],
+ [
+ 'account',
+ 'string'
+ // Надо добавить проверку существования аккаунта
+ ]
+ ];
+ }
+
+ public function attributeLabels()
+ {
+ return [
+ 'date' => 'Дата',
+ 'type' => 'Тип',
+ 'account' => 'Аккаунт'
+ ];
+ }
+
+ public function beforeSave($data)
+ {
+ if (parent::beforeSave($data)) {
+ if ($this->isNewRecord) {
+ $this->date = time();
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+}
diff --git a/mirzaev/skillparts/system/models/Product.php b/mirzaev/skillparts/system/models/Product.php
new file mode 100644
index 0000000..8ab6950
--- /dev/null
+++ b/mirzaev/skillparts/system/models/Product.php
@@ -0,0 +1,352 @@
+ 'Заполните поля: {attribute}',
+ 'except' => self::SCENARIO_IMPORT
+ ],
+ [
+ 'file',
+ 'required',
+ 'message' => 'Заполните поля: {attribute}',
+ 'on' => self::SCENARIO_IMPORT
+ ],
+ ['catn', 'integer', 'message' => '{attribute} должен быть числом'],
+ // ['oemn', 'integer'], Нужна своя проверка на массив
+ [
+ 'file',
+ 'file',
+ 'skipOnEmpty' => false,
+ 'extensions' => 'xlsx',
+ 'checkExtensionByMimeType' => false,
+ 'maxFiles' => 5,
+ 'maxSize' => 1024 * 1024 * 30,
+ 'wrongExtension' => 'Разрешены только документы в формате: ".xlsx"',
+ 'message' => 'Проблема при чтении документа',
+ 'on' => self::SCENARIO_IMPORT
+ ]
+ ]
+ );
+ }
+
+ public function attributeLabels()
+ {
+ return array_merge(
+ parent::attributeLabels(),
+ [
+ 'name' => 'Название (name)',
+ 'catn' => 'Каталожный номер (catn)',
+ 'oemn' => 'OEM номера (oemn)',
+ 'data' => 'Данные товара (data)',
+ 'cost' => 'Цены (cost)',
+ 'time' => 'Сроки доставки (time)',
+ 'file' => 'Документ',
+ 'group' => 'Группа',
+ ]
+ );
+ }
+
+ public function beforeSave($data)
+ {
+ if (parent::beforeSave($data)) {
+ if ($this->isNewRecord) {
+ // Надо избавиться от unset();
+ unset($this->_key);
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public function import()
+ {
+ // Инициализация массива данных
+ $data = [];
+
+ if ($this->validate()) {
+ foreach ($this->file as $file) {
+ // Перебор файлов
+
+ // Сохранение на диск
+ if (!file_exists('../assets/import/excel/')) {
+ mkdir('../assets/import/excel/', 0775, true);
+ }
+ $file->saveAs($path = '../assets/import/excel/' . $file->baseName . '.' . $file->extension);
+
+ // Проверка файла пройдена
+
+ $data[] = Excel::import($path, [
+ 'setFirstRecordAsKeys' => true,
+ 'setIndexSheetByName' => true,
+ ]);
+ }
+
+ foreach ($data[0] as $doc) {
+ // Перебор полученных документов
+
+ // Сохранение в базе данных
+ $product = new static($doc);
+
+ if ($product->validate()) {
+ // Проверка пройдена
+
+ // Запись документа
+ $product->save();
+
+ // Запись группы
+ $group = static::class . 'Group';
+ (new $group())->writeMember($product, $this->group);
+ } else {
+ // Проверка не пройдена
+ foreach ($product->errors as $attribute => $error) {
+ $this->addError($attribute, $error);
+ }
+ }
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Установка реквизитов для продукта
+ */
+ // public function setRequisite1c(string $name, string $value): bool
+ public function setRequisite1c($name, $value): bool
+ {
+ if (!$requisite = Requisite::readByName($name)) {
+ // Реквизиты не найдены
+
+ // Инициализация
+ $requisite = new Requisite();
+
+ $requisite->name = $name;
+ $requisite->value = $value;
+
+ // Запись
+ return $requisite->save();
+ }
+
+ return false;
+ }
+
+ /**
+ * Установка группы, где находится продукт
+ */
+ // public function setGroup1c(ProductGroup $group): bool
+ public function setGroup1c($group): bool
+ {
+ // Чтение группы
+ $group = SupplyGroup::readByOnecName($group->id)[0];
+
+ // Запись ребра: ПОСТАВКА => ГРУППА ПОСТАВОК
+ return static::writeEdgeBetweenGroup(static::collectionName() . '/' . $this->_key, $group->collectionName() . '/' . $group->_key);
+ }
+
+ /**
+ * Запись всех параметров. Вызывается 1 раз при импорте
+ */
+ public static function createProperties1c($properties): void
+ {
+ // Это нам не нужно, кажется, надо будет тестить
+
+ /**
+ * @var \Zenwalker\CommerceML\Model\Property $property
+ */
+ // foreach ($properties as $property) {
+ // $propertyModel = Property::createByMl($property);
+ // foreach ($property->getAvailableValues() as $value) {
+ // if (!$propertyValue = PropertyValue::findOne(['onec_name' => $value->id])) {
+ // $propertyValue = new PropertyValue();
+ // $propertyValue->name = (string)$value->Значение;
+ // $propertyValue->property_id = $propertyModel->id;
+ // $propertyValue->onec_name = (string)$value->ИдЗначения;
+ // $propertyValue->save();
+ // unset($propertyValue);
+ // }
+ // }
+ // }
+ }
+
+ /**
+ * $property - Свойство товара (import.xml > Классификатор > Свойства > Свойство)
+ * $property->value - Разыменованное значение (string) (import.xml > Классификатор > Свойства > Свойство > Значение)
+ * $property->getValueModel() - Данные по значению, Ид значения, и т.д (import.xml > Классификатор > Свойства > Свойство > ВариантыЗначений > Справочник)
+ *
+ * @param MlProperty $property
+ * @return void
+ */
+ public function setProperty1c($property): void
+ {
+ // Это тоже нам не нужно
+
+ // $propertyModel = Property::findOne(['onec_name' => $property->id]);
+ // $propertyValue = $property->getValueModel();
+ // if ($propertyAccountingId = (string)$propertyValue->ИдЗначения) {
+ // $value = PropertyValue::findOne(['onec_name' => $propertyAccountingId]);
+ // $attributes = ['property_value_id' => $value->id];
+ // } else {
+ // $attributes = ['value' => $propertyValue->value];
+ // }
+ // $this->addPivot($propertyModel, PvProductProperty::class, $attributes);
+ }
+
+ /**
+ * В этой фукнции мы получаем абсолютный путь до картинки и название изрбражения (для alt аттрибута)
+ *
+ * @param string $path
+ * @param string $caption
+ * @return mixed
+ */
+ public function addImage1c($path, $caption): bool
+ {
+ // if (!$this->getImages()->andWhere(['md5' => md5_file($path)])->exists()) {
+ // $this->addPivot(FileUpload::startUpload($path)->process(), PvProductImage::class, ['caption' => $caption]);
+ // }
+
+ return false;
+ }
+
+ /**
+ * В эту фукнцию отправляется xml данные предложения из файла
+ */
+ // public function getOffer1c(Supply $offer): Supply
+ public function getOffer1c($offer): Supply
+ {
+ $supply = Supply::createByMl($offer);
+ $supply->product_id = $this->id;
+ if ($supply->getDirtyAttributes()) {
+ $supply->save();
+ }
+
+ return $supply;
+ }
+
+ /**
+ * @param MlOffer $offer
+ */
+ public static function createByMl($offer): Supply
+ {
+ if (!$model = static::readByOnecName($offer->id)) {
+ // Нет записей в базе данных
+
+ // Инициализация
+ $model = new static;
+
+ $model->name = (string) $offer->name;
+ $model->onec_name = (string) $offer->id;
+ }
+
+ $model->remnant = (string) $offer->Количество;
+
+ return $model;
+ }
+
+ /**
+ * @param $product
+ * @return self
+ */
+ public static function createModel1c($product): static
+ {
+ if (!$model = static::findOne(['onec_name' => $product->id])) {
+ $model = new static();
+ $model->onec_name = $product->id;
+ }
+ $model->name = $product->name;
+ $model->description = (string) $product->Описание;
+ $model->article = (string) $product->Артикул;
+
+ $model->save();
+
+ return $model;
+ }
+
+ public function setRaw1cData($cml, $object)
+ {
+ }
+
+ /**
+ * Название поля в котором хранится ID из 1C
+ */
+ public static function getIdFieldName1c(): string
+ {
+ return 'onec_name';
+ }
+
+ private static function writeEdgeBetweenGroup(string $from, string $to): bool
+ {
+ // Инициализация
+ $edge = new SupplyEdgeSupplyGroup();
+
+ // Настройка
+ $edge->_from = $from;
+ $edge->_to = $to;
+
+ // Запись
+ return $edge->save();
+ }
+
+ private static function writeEdgeBetweenRequisite(string $from, string $to): bool
+ {
+ // Инициализация
+ $edge = new SupplyEdgeRequisite();
+
+ // Настройка
+ $edge->_from = $from;
+ $edge->_to = $to;
+
+ // Запись
+ return $edge->save();
+ }
+
+ public static function readById(string $_key): ?Product
+ {
+ return Product::findOne(['_key' => $_key]);
+ }
+
+ public function getGroup1c(): ProductGroup
+ {
+ return $this->group;
+ }
+
+ public static function readByOnecName(string $name): ?Product
+ {
+ return static::findOne([static::getIdFieldName1c() => $name]);
+ }
+}
diff --git a/mirzaev/skillparts/system/models/ProductEdgeProduct.php b/mirzaev/skillparts/system/models/ProductEdgeProduct.php
new file mode 100644
index 0000000..ac01dc5
--- /dev/null
+++ b/mirzaev/skillparts/system/models/ProductEdgeProduct.php
@@ -0,0 +1,11 @@
+ 'Заполните поле: {attribute}'
+ // ]
+ ]
+ );
+ }
+
+ public function attributeLabels()
+ {
+ return array_merge(
+ parent::attributeLabels(),
+ [
+ 'name' => 'Название (name)',
+ 'onec_name' => 'Название 1C (onec_name)',
+ 'onec_prnt_name' => 'Название родителя 1C (onec_prnt_name)',
+ ]
+ );
+ }
+
+ public function writeMember(Document $member, string $group)
+ {
+ if (isset($member->_key)) {
+ return static::writeEdgeBetweenMember($member->collectionName() . '/' . $member->_key, $this->collectionName() . '/' . $group);
+ }
+
+ return false;
+ }
+
+ /**
+ * Создание дерева групп
+ * в параметр передаётся массив всех групп (import.xml > Классификатор > Группы)
+ * $groups[0]->parent - родительская группа
+ * $groups[0]->children - дочерние группы
+ *
+ * @param Group[] $groups
+ */
+ public static function createTree1c($groups): Document|null
+ {
+ foreach ($groups as $group) {
+ // Перебор групп
+
+ // Создание
+ $parent = static::createByML($group);
+
+ if ($children = $group->getChildren()) {
+ // Найден потомок
+
+ // Вход в рекурсию
+ $children = static::createTree1c($children);
+
+ // Запись рёбер с родителем
+ static::writeEdgeBetweenGroup($parent::collectionName() . '/' . $parent->_key, $children::collectionName() . '/' . $children->_key);
+
+ return $children;
+ }
+
+ return $parent;
+ }
+ }
+
+ /**
+ * Создаём группу по модели группы CommerceML
+ * проверяем все дерево родителей группы, если родителя нет в базе - создаём
+ *
+ * @param Group $group
+ */
+ public static function createByML(Group $group): static|array|null
+ {
+ if (!$model = static::readByOnecName($group->id)) {
+ // Группа не найдена
+
+ // Инициализация
+ $model = new static;
+
+ $model->onec_name = $group->id;
+ }
+
+ $model->name = $group->name;
+
+ if ($parent = $group->getParent()) {
+ // Найден родитель
+
+ // Инициализация (рекурсия)
+ $parentModel = static::createByML($parent);
+
+ $model->onec_prnt_name = $parentModel->id;
+
+ unset($parentModel);
+ } else {
+ $model->onec_prnt_name = null;
+ }
+
+ $model->save();
+
+ return $model;
+ }
+
+ private static function writeEdgeBetweenMember(string $from, string $to): bool
+ {
+ // Инициализация
+ $edge = new ProductEdgeProductGroup();
+
+ // Настройка
+ $edge->_from = $from;
+ $edge->_to = $to;
+
+ // Запись
+ return $edge->save();
+ }
+
+ private static function writeEdgeBetweenGroup(string $from, string $to): bool
+ {
+ // Инициализация
+ $edge = new ProductGroupEdgeProductGroup();
+
+ // Настройка
+ $edge->_from = $from;
+ $edge->_to = $to;
+
+ // Запись
+ return $edge->save();
+ }
+
+ public static function readAll()
+ {
+ return static::find()->all();
+ }
+
+ public static function readByName(string $name)
+ {
+ return static::findOne(['name' => $name]);
+ }
+
+ /**
+ * Название поля в котором хранится ID из 1C
+ */
+ public static function getIdFieldName1c(): string
+ {
+ return 'onec_name';
+ }
+
+ public static function readByOnecName(string $name): ?Product
+ {
+ return static::findOne([static::getIdFieldName1c() => $name]);
+ }
+}
diff --git a/mirzaev/skillparts/system/models/ProductGroupEdgeProductGroup.php b/mirzaev/skillparts/system/models/ProductGroupEdgeProductGroup.php
new file mode 100644
index 0000000..2492cf8
--- /dev/null
+++ b/mirzaev/skillparts/system/models/ProductGroupEdgeProductGroup.php
@@ -0,0 +1,11 @@
+andWhere(['status_id' => 2])->all();
+ }
+
+ /**
+ * @return OfferInterface[]
+ */
+ public function getOffers1c()
+ {
+ return $this->offers;
+ }
+
+ public function getRequisites1c()
+ {
+ }
+
+ /**
+ * Получаем контрагента у документа
+ *
+ * @return PartnerInterface
+ */
+ public function getPartner1c()
+ {
+ return $this->user;
+ }
+
+ public function getExportFields1c($context = null)
+ {
+ return [
+ 'Ид' => 'id',
+ 'Наименование' => 'login',
+ 'ПолноеНаименование' => 'full_name',
+ 'Фамилия' => 'surname',
+ 'Имя' => 'name',
+ 'Контакты' => [
+ [
+ '@name' => 'Контакт',
+ 'Тип' => 'Почта',
+ 'Значение' => $this->email,
+ ],
+ [
+ '@name' => 'Контакт',
+ 'Тип' => 'ТелефонРабочий',
+ 'Значение' => $this->phone,
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Возвращаем имя поля в базе данных, в котором хранится ID из 1с
+ *
+ * @return string
+ */
+ public static function getIdFieldName1c()
+ {
+ return 'accounting_id';
+ }
+
+ public function setRaw1cData($cml, $object)
+ {
+ }
+}
diff --git a/mirzaev/skillparts/system/models/PurchaseEdgeSupply.php b/mirzaev/skillparts/system/models/PurchaseEdgeSupply.php
new file mode 100644
index 0000000..3d19e6f
--- /dev/null
+++ b/mirzaev/skillparts/system/models/PurchaseEdgeSupply.php
@@ -0,0 +1,11 @@
+ 'Заполните поле: {attribute}'
+ ]
+ ]
+ );
+ }
+
+ public function attributeLabels()
+ {
+ return array_merge(
+ parent::attributeLabels(),
+ [
+ 'name' => 'Название',
+ 'value' => 'Значение'
+ ]
+ );
+ }
+
+ public static function readByName(string $name)
+ {
+ return static::findOne(['name' => $name]);
+ }
+}
diff --git a/mirzaev/skillparts/system/models/Supply.php b/mirzaev/skillparts/system/models/Supply.php
new file mode 100644
index 0000000..d5b0277
--- /dev/null
+++ b/mirzaev/skillparts/system/models/Supply.php
@@ -0,0 +1,158 @@
+catn))) {
+ // Товар не найден
+
+ // Инициализация
+ $product = (new Product(array_intersect_key($this->getAttributes(), (new Product)->getAttributes())));
+
+ // Запись
+ if (!$product->save()) {
+ return false;
+ }
+ }
+
+ // Запись рёбер: АККАУНТ => ПОСТАВКА => ТОВАР, и проверка на то, что оба созданы
+ static::writeEdgeBetweenAccount(Account::collectionName() . '/' . Yii::$app->user->identity->_key, static::collectionName() . '/' . $this->_key);
+ static::writeEdgeBetweenProduct(static::collectionName() . '/' . $this->_key, Product::collectionName() . '/' . $product->_key);
+ }
+
+ /**
+ * В этом методе необходимо создать все типы цен, фукнция вызывается один раз
+ */
+ public static function createPriceTypes1c($types): void
+ {
+ foreach ($types as $type) {
+ // PriceType::createByMl($type);
+ }
+ }
+
+ /**
+ * offers.xml > ПакетПредложений > Предложения > Предложение > Цены
+ *
+ * Цена товара,
+ * К $price можно обратиться как к массиву, чтобы получить список цен (Цены > Цена)
+ * $price->type - тип цены (offers.xml > ПакетПредложений > ТипыЦен > ТипЦены)
+ *
+ * @param \Zenwalker\CommerceML\Model\Price $price
+ */
+ public function setPrice1c($price): void
+ {
+ // $priceType = PriceType::findOne(['accounting_id' => $price->getType()->id]);
+ // $priceModel = Price::createByMl($price, $this, $priceType);
+ // $this->addPivot($priceModel, PvOfferPrice::class);
+ }
+
+ /**
+ * offers.xml > ПакетПредложений > Предложения > Предложение > ХарактеристикиТовара > ХарактеристикаТовара
+ *
+ * Характеристики товара
+ * $name - Наименование
+ * $value - Значение
+ *
+ * @param \Zenwalker\CommerceML\Model\Simple $specification
+ * @return void
+ */
+ public function setSpecification1c($specification)
+ {
+ // $specificationModel = Specification::createByMl($specification);
+ // $this->addPivot($specificationModel, PvOfferSpecification::class, ['value' => (string)$specification->Значение]);
+ }
+
+ public function getExportFields1c($context = null)
+ {
+ return [
+ 'Ид' => 'id',
+ 'Наименование' => 'login',
+ 'ПолноеНаименование' => 'full_name',
+ 'Фамилия' => 'surname',
+ 'Имя' => 'name',
+ 'Контакты' => [
+ [
+ '@name' => 'Контакт',
+ 'Тип' => 'Почта',
+ 'Значение' => $this->email,
+ ],
+ [
+ '@name' => 'Контакт',
+ 'Тип' => 'ТелефонРабочий',
+ 'Значение' => $this->phone,
+ ],
+ ],
+ ];
+ }
+
+ public static function writeEdgeBetweenAccount(string $from, string $to): bool
+ {
+ // Инициализация
+ $edge = new AccountEdgeSupply();
+
+ // Настройка
+ $edge->_from = $from;
+ $edge->_to = $to;
+
+ // Запись
+ return $edge->save();
+ }
+
+ private static function writeEdgeBetweenProduct(string $from, string $to): bool
+ {
+ // Инициализация
+ $edge = new SupplyEdgeProduct();
+
+ // Настройка
+ $edge->_from = $from;
+ $edge->_to = $to;
+
+ // Запись
+ return $edge->save();
+ }
+
+ private static function writeEdgeBetweenGroup(string $from, string $to): bool
+ {
+ // Инициализация
+ $edge = new SupplyEdgeSupplyGroup();
+
+ // Настройка
+ $edge->_from = $from;
+ $edge->_to = $to;
+
+ // Запись
+ return $edge->save();
+ }
+
+ private static function writeEdgeBetweenRequisite(string $from, string $to): bool
+ {
+ // Инициализация
+ $edge = new SupplyEdgeRequisite();
+
+ // Настройка
+ $edge->_from = $from;
+ $edge->_to = $to;
+
+ // Запись
+ return $edge->save();
+ }
+
+ public static function readByCatn(string $catn): ?Product
+ {
+ return Product::findOne(['catn' => $catn]);
+ }
+}
diff --git a/mirzaev/skillparts/system/models/SupplyEdgeProduct.php b/mirzaev/skillparts/system/models/SupplyEdgeProduct.php
new file mode 100644
index 0000000..0f5cf21
--- /dev/null
+++ b/mirzaev/skillparts/system/models/SupplyEdgeProduct.php
@@ -0,0 +1,11 @@
+_from = $from;
+ $edge->_to = $to;
+
+ // Запись
+ return $edge->save();
+ }
+
+ protected static function writeEdgeBetweenGroup(string $from, string $to): bool
+ {
+ // Инициализация
+ $edge = new SupplyGroupEdgeSupplyGroup();
+
+ // Настройка
+ $edge->_from = $from;
+ $edge->_to = $to;
+
+ // Запись
+ return $edge->save();
+ }
+
+ public static function readByOnecName(string $onec_name): ?Product
+ {
+ return static::findOne(['onec_name' => $onec_name]);
+ }
+}
diff --git a/mirzaev/skillparts/system/models/SupplyGroupEdgeSupplyGroup.php b/mirzaev/skillparts/system/models/SupplyGroupEdgeSupplyGroup.php
new file mode 100644
index 0000000..181d7f1
--- /dev/null
+++ b/mirzaev/skillparts/system/models/SupplyGroupEdgeSupplyGroup.php
@@ -0,0 +1,11 @@
+ [
- 'id' => '100',
- 'username' => 'admin',
- 'password' => 'admin',
- 'authKey' => 'test100key',
- 'accessToken' => '100-token',
- ],
- '101' => [
- 'id' => '101',
- 'username' => 'demo',
- 'password' => 'demo',
- 'authKey' => 'test101key',
- 'accessToken' => '101-token',
- ],
- ];
-
-
- /**
- * {@inheritdoc}
- */
- public static function findIdentity($id)
- {
- return isset(self::$users[$id]) ? new static(self::$users[$id]) : null;
- }
-
- /**
- * {@inheritdoc}
- */
- public static function findIdentityByAccessToken($token, $type = null)
- {
- foreach (self::$users as $user) {
- if ($user['accessToken'] === $token) {
- return new static($user);
- }
- }
-
- return null;
- }
-
- /**
- * Finds user by username
- *
- * @param string $username
- * @return static|null
- */
- public static function findByUsername($username)
- {
- foreach (self::$users as $user) {
- if (strcasecmp($user['username'], $username) === 0) {
- return new static($user);
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getId()
- {
- return $this->id;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getAuthKey()
- {
- return $this->authKey;
- }
-
- /**
- * {@inheritdoc}
- */
- public function validateAuthKey($authKey)
- {
- return $this->authKey === $authKey;
- }
-
- /**
- * Validates password
- *
- * @param string $password password to validate
- * @return bool if password provided is valid for current user
- */
- public function validatePassword($password)
- {
- return $this->password === $password;
- }
-}
diff --git a/mirzaev/skillparts/system/views/account.php b/mirzaev/skillparts/system/views/account.php
new file mode 100644
index 0000000..2fa994d
--- /dev/null
+++ b/mirzaev/skillparts/system/views/account.php
@@ -0,0 +1,43 @@
+
+
+
+
+
+ 'form_account',
+ 'action' => false,
+ 'fieldConfig' => [
+ 'template' => '{label}{input}{error}',
+ 'options' => ['class' => '']
+ ],
+ 'options' => [
+ 'class' => '',
+ 'onsubmit' => 'return false;'
+ ]
+ ]);
+
+ $model = $model ?? new AccountForm;
+ ?>
+
+ = $form->field($model, 'mail', ['enableLabel' => false])->textInput(['autofocus' => true, 'placeholder' => $model->getAttributeLabel('mail')]) ?>
+ = $form->field($model, 'pswd', ['enableLabel' => false])->passwordInput(['placeholder' => $model->getAttributeLabel('pswd')]) ?>
+
+
+ = Html::submitButton('Войти', ['name' => 'submitAuthentication', 'onclick' => 'authentication(this.parentElement.parentElement);', 'class' => 'flex-grow-1 mr-2 btn btn-primary button_clean']) ?>
+ = $form->field($model, 'auto', ['checkboxTemplate' => '
{beginLabel}' .
+ Html::submitButton('{labelTitle}', ['name' => 'submit', 'data-toggle' => 'button', 'class' => 'w-100 btn btn-primary button_clean', 'aria-pressed' => 'false']) .
+ '{endLabel}
'])->checkbox()->label($model->getAttributeLabel('auto'), ['class' => 'w-100 m-0']) ?>
+
+ = Html::submitButton('Регистрация', ['name' => 'submitRegistration', 'onclick' => 'registration(this.parentElement);', 'class' => 'col-12 ml-auto btn btn-success btn-sm button_clean']) ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/mirzaev/skillparts/system/views/error.php b/mirzaev/skillparts/system/views/error.php
new file mode 100644
index 0000000..aeb7bbb
--- /dev/null
+++ b/mirzaev/skillparts/system/views/error.php
@@ -0,0 +1,16 @@
+title = $name;
+
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = nl2br(Html::encode($message)) ?>
+
+
+
diff --git a/mirzaev/skillparts/system/views/index.php b/mirzaev/skillparts/system/views/index.php
new file mode 100644
index 0000000..ed534e7
--- /dev/null
+++ b/mirzaev/skillparts/system/views/index.php
@@ -0,0 +1,86 @@
+title = 'SkillParts';
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Масла, смазки
+
+
+
+ - Масла моторные
+ - Масла трансмиссионные
+ - Масла гидравлические
+ - Смазки
+
+
+
+
+
+
Электрооборудование
+
+
+
+
+
+
Инструмент
+
+
+
+ - Шприцы для смазки
+ - Ключи, съёмники
+ - Наборы инструментов
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mirzaev/skillparts/system/views/layouts/main.php b/mirzaev/skillparts/system/views/layouts/main.php
index cb989ba..c95eea4 100644
--- a/mirzaev/skillparts/system/views/layouts/main.php
+++ b/mirzaev/skillparts/system/views/layouts/main.php
@@ -7,8 +7,11 @@ use yii\helpers\Html;
use app\assets\AppAsset;
AppAsset::register($this);
+
?>
+
beginPage() ?>
+
@@ -24,80 +27,70 @@ AppAsset::register($this);
beginBody() ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Запчасти для спецтехники
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
Запчасти для спецтехники
+
+
+
-
+
+
+
= $content ?>
-