From d3ca22527b4e3c0bc97a7c29fa15f26da96b318e Mon Sep 17 00:00:00 2001 From: marina Date: Fri, 21 Feb 2025 11:40:27 +0300 Subject: [PATCH] =?utf8?q?ERP-302=20=D0=A0=D0=B5=D0=B4=D0=B0=D0=BA=D1=82?= =?utf8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B1=D1=83?= =?utf8?q?=D0=BA=D0=B5=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/records/BouquetComposition.php | 3 +- erp24/views/bouquet/_product_edit.php | 40 +++++++++++++++++++++++---- erp24/web/js/bouquet/bouquet.js | 25 +++++++++-------- 3 files changed, 51 insertions(+), 17 deletions(-) diff --git a/erp24/records/BouquetComposition.php b/erp24/records/BouquetComposition.php index 622d545f..a696f135 100644 --- a/erp24/records/BouquetComposition.php +++ b/erp24/records/BouquetComposition.php @@ -216,8 +216,9 @@ class BouquetComposition extends ActiveRecord public static function disabledButtons($isCreate = false) { - if ($isCreate || date('d') < 10) { + if (!$isCreate || date('d') > 10) { return false; } + return true; } } diff --git a/erp24/views/bouquet/_product_edit.php b/erp24/views/bouquet/_product_edit.php index e1f5b9c6..49332ae0 100644 --- a/erp24/views/bouquet/_product_edit.php +++ b/erp24/views/bouquet/_product_edit.php @@ -15,15 +15,23 @@ use yii\helpers\Html; 'filterFields' => ['size', 'color', 'species', 'category', 'type-num'] ]) ?>
+
-
-
+
+ +
+ +
+
+

Себестоимость: ₽

-

Наценка:

+

Наценка:

Цена: ₽

-
+ +
+
'btn btn-warning calculate-btn w-100']) ?> @@ -36,5 +44,27 @@ use yii\helpers\Html; 'btn btn-warning calculate-btn w-100']) ?>
-
+ diff --git a/erp24/web/js/bouquet/bouquet.js b/erp24/web/js/bouquet/bouquet.js index be53e056..67765fb1 100644 --- a/erp24/web/js/bouquet/bouquet.js +++ b/erp24/web/js/bouquet/bouquet.js @@ -1,6 +1,6 @@ -document.addEventListener('DOMContentLoaded', function() { +document.addEventListener('DOMContentLoaded', function () { document.querySelectorAll('.video-preview').forEach(video => { - video.addEventListener('click', function() { + video.addEventListener('click', function () { this.controls = true; this.muted = false; this.play(); @@ -22,19 +22,19 @@ $(document).ready(function () { $.ajax({ url: '/bouquet/get-sales-data', type: 'POST', - data: { year: year, month: month, id: id }, + data: {year: year, month: month, id: id}, dataType: 'json', - success: function(response) { + success: function (response) { if (response) { ['offline', 'online', 'marketplace'].forEach(type => { - $.each(response[type], function(_, value) { + $.each(response[type], function (_, value) { let inputSelector = `input[name='BouquetForecast[type_sales_value][${type}][${value.id}]']`; $(inputSelector).val(value.value); }); }); } }, - error: function(xhr, status, error) { + error: function (xhr, status, error) { console.error("Ошибка загрузки данных:", status, error); } }); @@ -57,9 +57,9 @@ $('.calculate-btn').on('click', function () { } }); - $('.cost-value').text(null); - $('.selfcost-value').text(null); - $('.markup-value').text(null); + // Показываем прелоадер + $(".loader-overlay").removeClass("d-none"); + $(".content-wrapper").addClass("position-relative"); $.ajax({ url: '/bouquet/get-calculates', @@ -67,7 +67,7 @@ $('.calculate-btn').on('click', function () { contentType: 'application/json', data: JSON.stringify(data), dataType: 'json', - success: function(response) { + success: function (response) { if (response) { if (response.cost !== undefined) { $('.cost-value').text(response.cost); @@ -80,8 +80,11 @@ $('.calculate-btn').on('click', function () { } } }, - error: function(xhr, status, error) { + error: function (xhr, status, error) { console.error("Ошибка загрузки данных:", status, error); + }, + complete: function () { + $(".loader-overlay").addClass("d-none"); } }); }); -- 2.39.5