From: fomichev Date: Mon, 31 Mar 2025 06:22:39 +0000 (+0300) Subject: Скрываем если нет плановых показателей X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=ed33810ba0439921a3c4161973e57513c95ee052;p=erp24_rep%2Fyii-erp24%2F.git Скрываем если нет плановых показателей --- diff --git a/erp24/records/BouquetForecast.php b/erp24/records/BouquetForecast.php index 66b38a03..69323d97 100644 --- a/erp24/records/BouquetForecast.php +++ b/erp24/records/BouquetForecast.php @@ -118,7 +118,7 @@ class BouquetForecast extends ActiveRecord ->asArray() ->all(); - if (empty($list)) { + /*if (empty($list)) { $list = $defaultModel::find() ->andWhere($defaultCondition) ->select([ @@ -129,7 +129,7 @@ class BouquetForecast extends ActiveRecord ->orderBy($defaultModel === CityStore::class ? 'id' : 'sequence_number') ->asArray() ->all(); - } + }*/ return $list; } diff --git a/erp24/views/bouquet/_form.php b/erp24/views/bouquet/_form.php index a2c0ba7a..1e9dc340 100644 --- a/erp24/views/bouquet/_form.php +++ b/erp24/views/bouquet/_form.php @@ -260,7 +260,7 @@ $form = ActiveForm::begin([ 'text-center font-weight-bold pt-4 h6']) ?>
-
+
@@ -278,7 +278,7 @@ $form = ActiveForm::begin([ 'text-center font-weight-bold pt-3 h6']) ?>
-
+
@@ -296,7 +296,7 @@ $form = ActiveForm::begin([ 'text-center font-weight-bold pt-3 h6']) ?>
-
+
diff --git a/erp24/web/js/bouquet/bouquet.js b/erp24/web/js/bouquet/bouquet.js index 316b0a2e..3c6f7849 100644 --- a/erp24/web/js/bouquet/bouquet.js +++ b/erp24/web/js/bouquet/bouquet.js @@ -71,15 +71,24 @@ $(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) { - if (response) { - ['offline', 'online', 'marketplace'].forEach(type => { - $.each(response[type], function (_, value) { - let inputSelector = `input[name='BouquetForecast[type_sales_value][${type}][${value.id}]']`; - $(inputSelector).val(value.value); - }); + if (response && response.success) { + ['offline', 'online', 'marketplace'].forEach(function(type) { + let container = $('#' + type + '-container'); + if (!response[type] || response[type].length === 0) { + container.html('

Для периода нет плановых данных

'); + } else { + let newHtml = ''; + $.each(response[type], function (_, item) { + newHtml += '
'; + newHtml += '
'; + newHtml += '
'; + newHtml += '
'; + }); + container.html(newHtml); + } }); } },