From: marina Date: Fri, 21 Feb 2025 08:40:27 +0000 (+0300) Subject: ERP-302 Редактирование букета X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=d3ca22527b4e3c0bc97a7c29fa15f26da96b318e;p=erp24_rep%2Fyii-erp24%2F.git ERP-302 Редактирование букета --- 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"); } }); });