diff --git a/mirzaev/skillparts/system/models/Document.php b/mirzaev/skillparts/system/models/Document.php index 32c324c..7bbc430 100644 --- a/mirzaev/skillparts/system/models/Document.php +++ b/mirzaev/skillparts/system/models/Document.php @@ -221,11 +221,11 @@ abstract class Document extends ActiveRecord /** * Конвертировать _id в _key */ - private static function keyFromId(string $_id): string + private static function keyFromId(string $_id): ?string { - $_key = preg_match_all('/\/([0-9]+)$/m', $_id, $mathes); + preg_match_all('/\/([0-9]+)$/m', $_id, $mathes); - return $mathes[0][1]; + return $mathes[1][0] ?? null; } /** diff --git a/mirzaev/skillparts/system/models/Edge.php b/mirzaev/skillparts/system/models/Edge.php index a264f14..0314c34 100644 --- a/mirzaev/skillparts/system/models/Edge.php +++ b/mirzaev/skillparts/system/models/Edge.php @@ -139,6 +139,12 @@ abstract class Edge extends Document /** * Поиск ребра по его вершинам + * + * @param string $_from Идентификатор исходящей вершины + * @param string $_to Идентификатор входящей вершины + * @param string|null $type deprecated + * @param int $limit Ограничение по количеству + * @param array|null $filter Фильтр (where()) */ public static function searchByVertex(string $_from, string $_to, string|null $type = null, int $limit = 1, array|null $filter = null): array|null { diff --git a/mirzaev/skillparts/system/models/Supply.php b/mirzaev/skillparts/system/models/Supply.php index 7312085..6c4a975 100644 --- a/mirzaev/skillparts/system/models/Supply.php +++ b/mirzaev/skillparts/system/models/Supply.php @@ -876,4 +876,29 @@ class Supply extends Product implements ProductInterface, OfferInterface // Отправка return (bool) $model->write(); } + + /** + * Поиск связи поставки с товаром + * + * Если не передать товар, то ищется любой товар с которым есть связь + * + * @param Product|null $product Товар с которым проверяется связь + * @param int $limit Ограничение по максимальному количеству + */ + public function searchConnectWithProduct(Product|null $product = null, int $limit = 1): SupplyEdgeProduct|array|null + { + if (isset($product)) { + // Передан товар + + $edge = SupplyEdgeProduct::searchByVertex($this->readId(), $product->readId(), filter: ['type' => 'connect'], limit: $limit); + + return $limit === 1 ? $edge[0] ?? null : $edge; + } else { + // Не передан товар + + $edge = SupplyEdgeProduct::searchBySupplyId($this->readId(), $limit); + + return $limit === 1 ? $edge[0] ?? null : $edge; + } + } } diff --git a/mirzaev/skillparts/system/models/SupplyEdgeProduct.php b/mirzaev/skillparts/system/models/SupplyEdgeProduct.php index 314d0b8..efa6a39 100644 --- a/mirzaev/skillparts/system/models/SupplyEdgeProduct.php +++ b/mirzaev/skillparts/system/models/SupplyEdgeProduct.php @@ -68,6 +68,12 @@ class SupplyEdgeProduct extends Edge implements OfferInterface return self::findOne([self::getIdFieldName1c() => $ocid]); } + /** + * Поиск по идентификатору поставки + * + * @param string $_id Идентификатор поставки + * @param int $limit Ограничение по максимальному количеству + */ public static function searchBySupplyId(string $_id, int $limit = 1): array { return self::find()->where(['_from' => $_id])->limit($limit)->all(); diff --git a/mirzaev/skillparts/system/views/profile/panel.php b/mirzaev/skillparts/system/views/profile/panel.php index df9ec8f..6e0740f 100644 --- a/mirzaev/skillparts/system/views/profile/panel.php +++ b/mirzaev/skillparts/system/views/profile/panel.php @@ -8,6 +8,7 @@ use yii\helpers\Html; use app\models\Notification; use app\models\Account; +use app\models\Document; use app\models\Product; use app\models\Settings; use app\models\Supply; @@ -124,19 +125,19 @@ $timezone = $timezone[1][0];
.
-
+
name ?? 'Неизвестно' ?>
-
+
indx ?? '' ?>
-
+
agnt ? 'Поставщик' : 'Покупатель' ?>
-
+
type() ?>
-
+
@@ -187,9 +188,9 @@ $timezone = $timezone[1][0];
.
- +
@@ -215,6 +216,18 @@ $timezone = $timezone[1][0]; ?> readId())['_key']; + + // Деинициализация товара + unset($product); + + if ($connect = $supply->searchConnectWithProduct()) { + // Найдена привязка поставки к аккаунту + + $product = Product::searchById($connect->_to); + } + foreach ($supply->jrnl ?? [] as $jrnl) { // Перебор записей в журнале @@ -233,22 +246,28 @@ $timezone = $timezone[1][0];
.
-
+
catn ?? 'Неизвестно' ?>
-
+
dscr ?? 'Без описания' ?>
-
- amnt ?? '0' ?> шт +
+ amnt ?? '0' ?>шт
-
- cost ?? '0' ?> р +
+ cost ?? '0' ?>р
-
+
- + + + + catn" ?>"> + + +
diff --git a/mirzaev/skillparts/system/views/profile/supplies.php b/mirzaev/skillparts/system/views/profile/supplies.php index 442b125..bd8e69e 100644 --- a/mirzaev/skillparts/system/views/profile/supplies.php +++ b/mirzaev/skillparts/system/views/profile/supplies.php @@ -115,7 +115,7 @@ $panel ?? $panel = 'profile_panel_supplies_input_import';
- + diff --git a/mirzaev/skillparts/system/web/Nginx_1.21_vhost.conf b/mirzaev/skillparts/system/web/Nginx_1.21_vhost.conf index b8a6998..6fa7468 100644 --- a/mirzaev/skillparts/system/web/Nginx_1.21_vhost.conf +++ b/mirzaev/skillparts/system/web/Nginx_1.21_vhost.conf @@ -4,74 +4,97 @@ server { -listen %ip%:%httpport% default; -listen %ip%:%httpsport% ssl http2 default; + listen %ip%:%httpport% default; + listen %ip%:%httpsport% ssl http2 default; -server_name skillparts.loc %aliases%; -root '%hostdir%'; -limit_conn addr 64; -autoindex off; -index index_dev.php index_dev.html index_dev.htm; + server_name skillparts.loc %aliases%; + root '%hostdir%'; + limit_conn addr 64; + autoindex off; + index index_dev.php index_dev.html index_dev.htm; -ssl_certificate '%sprogdir%/userdata/config/cert_files/server.crt'; -ssl_certificate_key '%sprogdir%/userdata/config/cert_files/server.key'; -# ssl_trusted_certificate ''; + ssl_certificate '%sprogdir%/userdata/config/cert_files/server.crt'; + ssl_certificate_key '%sprogdir%/userdata/config/cert_files/server.key'; + # ssl_trusted_certificate ''; -# Force HTTPS -add_header Strict-Transport-Security 'max-age=2592000' always; -if ($scheme ~* ^(?!https).*$) { - return 301 https://$host$request_uri; -} + # Force HTTPS + add_header Strict-Transport-Security 'max-age=2592000' always; + if ($scheme ~* ^(?!https).*$) { + return 301 https://$host$request_uri; + } -# Force www.site.com => site.com -if ($host ~* ^www\.(.+)$) { - return 301 $scheme://$1$request_uri; -} + # Force www.site.com => site.com + if ($host ~* ^www\.(.+)$) { + return 301 $scheme://$1$request_uri; + } -# Disable access to backup/config/command/log files -# if ($uri ~* ^.+\.(?:bak|co?nf|in[ci]|log|orig|sh|sql|tar|sql|t?gz|cmd|bat)$) { -# return 404; -# } + # Disable access to backup/config/command/log files + # if ($uri ~* ^.+\.(?:bak|co?nf|in[ci]|log|orig|sh|sql|tar|sql|t?gz|cmd|bat)$) { + # return 404; + # } -# Disable access to hidden files/folders -if ($uri ~* /\.(?!well-known)) { - return 404; -} + # Disable access to hidden files/folders + if ($uri ~* /\.(?!well-known)) { + return 404; + } -# Disable MIME sniffing -add_header X-Content-Type-Options 'nosniff' always; + # Disable MIME sniffing + add_header X-Content-Type-Options 'nosniff' always; -location ~* ^.+\.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv|svgz?|ttf|ttc|otf|eot|woff2?)$ { + location ~* ^.+\.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv|svgz?|ttf|ttc|otf|eot|woff2?)$ { expires 1d; access_log off; -} - -location / { - # Force index.php routing (if not found) - try_files $uri $uri/ /index_dev.php$is_args$args; - - # Force index.php routing (all requests) - # rewrite ^/(.*)$ /index.php?/$1 last; - - location ~ \.php$ { - try_files $fastcgi_script_name =404; - - # limit_conn addr 16; - # limit_req zone=flood burst=32 nodelay; - - # add_header X-Frame-Options 'SAMEORIGIN' always; - # add_header Referrer-Policy 'no-referrer-when-downgrade' always; - - # CSP syntax: (http: https: data: mediastream: blob: filesystem:) 'self' 'unsafe-inline' 'unsafe-eval' 'none' - # Content-Security-Policy-Report-Only (report-uri https://site.com/csp/) - # add_header Content-Security-Policy "default-src 'self'; connect-src 'self'; font-src 'self'; frame-src 'self'; img-src 'self'; manifest-src 'self'; media-src 'self'; object-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; base-uri 'none'; form-action 'self'; frame-ancestors 'self'; upgrade-insecure-requests" always; - - fastcgi_pass backend; - include '%sprogdir%/userdata/config/nginx_fastcgi_params.txt'; } -} -} -# ---------------------------- -# End host config -# ---------------------------- + location / { + # Force index.php routing (if not found) + try_files $uri $uri/ /index_dev.php$is_args$args; + + # Force index.php routing (all requests) + # rewrite ^/(.*)$ /index.php?/$1 last; + + location ~ \.php$ { + try_files $fastcgi_script_name =404; + + # limit_conn addr 16; + # limit_req zone=flood burst=32 nodelay; + + # add_header X-Frame-Options 'SAMEORIGIN' always; + # add_header Referrer-Policy 'no-referrer-when-downgrade' always; + # CSP syntax: (http: https: data: mediastream: blob: filesystem:) 'self' 'unsafe-inline' 'unsafe-eval' 'none' + # Content-Security-Policy-Report-Only (report-uri https://site.com/csp/) + # add_header Content-Security-Policy "default-src 'self'; connect-src 'self'; font-src 'self'; frame-src 'self'; img-src 'self'; manifest-src 'self'; media-src 'self'; object-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; base-uri 'none'; form-action 'self'; frame-ancestors 'self'; upgrade-insecure-requests" always; + fastcgi_pass backend; + include '%sprogdir%/userdata/config/nginx_fastcgi_params.txt'; + } + } + # Service configuration (do not edit!) + # ---------------------------- + location /openserver/ { + root 'e:/programs/openserver/modules/system/html'; + autoindex off; + index index.php index.html index.htm; + allow all; + allow 127.0.0.0/8; + allow ::1/128; + allow 127.0.0.1; + deny all; + location ~* ^/openserver/.+\.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|webm|svgz?|ttf|ttc|otf|eot|woff2?)$ { + expires 1d; + access_log off; + } + location /openserver/server-status { + stub_status on; + } + location ~ ^/openserver/.*\.php$ { + try_files $fastcgi_script_name =404; + fastcgi_index index.php; + fastcgi_pass backend; + include 'e:/programs/openserver/userdata/config/nginx_fastcgi_params.txt'; + } + } + + # ---------------------------- + # End host config + # ---------------------------- +} diff --git a/mirzaev/skillparts/system/web/css/main.css b/mirzaev/skillparts/system/web/css/main.css index 540658b..6593353 100644 --- a/mirzaev/skillparts/system/web/css/main.css +++ b/mirzaev/skillparts/system/web/css/main.css @@ -164,8 +164,7 @@ main { transition: 0s; } -.button_red_softer:active, -.button_red_softer:focus { +.button_red_softer:is(:active, :focus) { color: #ddd; background-color: #b82d2d; transition: 0s; @@ -176,6 +175,18 @@ main { background-color: #fff; } +.icon_red { + color: #ce2c2c; +} + +.icon_red:hover { + color: #da3636; +} + +.icon_red:is(:active, :focus) { + color: #b82d2d; +} + :is(.button_white, .button_white_small):is(.hover,:hover) { background-color: #eaebee; transition: 0s;