From: vladfo Date: Fri, 27 Sep 2024 11:14:37 +0000 (+0300) Subject: Убрал лишний файл и вывел отладочную X-Git-Tag: 1.5~1^2~8 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=d9f8aaaac1ce6d49e7d50102b203c8d8e0ffb16b;p=erp24_rep%2Fyii-erp24%2F.git Убрал лишний файл и вывел отладочную --- diff --git a/erp24/views/charts-for-management/index.php b/erp24/views/charts-for-management/index.php deleted file mode 100644 index 157dbc41..00000000 --- a/erp24/views/charts-for-management/index.php +++ /dev/null @@ -1,1060 +0,0 @@ - $access_chart) { - foreach ($access_chart['mode_level'] as $key => $item) { - $select_mode_json[$chart_name][] = ['id' => $key, 'text' => $item]; - } - -} - -$select_shift_json = []; - -foreach ($access as $chart_name => $access_chart) { - foreach ($access_chart['mode_shift'] as $key => $item) { - $select_shift_json[$chart_name][] = ['id' => $key, 'text' => $item]; - } - -} - -$select_mode_json = Json::encode($select_mode_json); -$select_shift_json = Json::encode($select_shift_json); - -$this->registerCss(<<registerJsFile('/js/charts/apexcharts.js', ['position' => \yii\web\View::POS_END]); - -$this->registerJs(<< new Date(date_end) || (new Date(date_end) > new Date() && atribut_group_name === 'fot')) { - information_row.html('

Ошибка валидации:
Дата начала должна быть больше даты окончания выборки!
Даты должны быть заполнены!
Дата окончания не может быть больше текущей даты!

'); - if (atribut_group_name === 'fot') { - information_row.append('
Дата окончания не может быть больше текущей даты!') - } - - $('button[id*="update"][id*="' + attribute + '"][attribute*="' + attribute + '"]').prop('disabled', true); - return; - } - $('button[id*="update"][id*="' + attribute + '"][attribute*="' + attribute + '"]').prop('disabled', false); - UpdateSelectorsDate (date_start, date_end, atribut_group_name, postfix, id); - } - - function ModeChanges (attribute, value) { - let attribute_split_DOM = attribute.split('-'); - let atribut_group_name = attribute_split_DOM[0]; - let postfix = attribute_split_DOM[1]; - let id = attribute_split_DOM[2]; - - let cluster_select = $('[id*="cluster-select"][attribute="' + atribut_group_name + ((postfix !== undefined) ? ('-' + postfix) : '') + ((id !== undefined) ? ('-' + id) : '') + '"]'); - let store_select = $('[id*="store-select"][attribute="' + atribut_group_name + ((postfix !== undefined) ? ('-' + postfix) : '') + ((id !== undefined) ? ('-' + id) : '') + '"]'); - - switch (parseInt(value)) { - case 0: - - cluster_select.val(null); - cluster_select.prop('disabled', true); - cluster_select.trigger('change'); - - store_select.val(null); - store_select.empty(); - store_select.prop('disabled', true); - store_select.trigger('change'); - - break; - case 1: - - cluster_select.val(null); - cluster_select.prop('disabled', true); - cluster_select.trigger('change'); - - store_select.val(null); - store_select.empty(); - store_select.prop('disabled', true); - store_select.trigger('change'); - - break; - case 2: - cluster_select.val(null); - cluster_select.prop('disabled', false); - cluster_select.trigger('change'); - - store_select.val(null); - store_select.empty(); - store_select.prop('disabled', true); - store_select.trigger('change'); - - break; - case 3: - cluster_select.val(null); - cluster_select.prop('disabled', false); - cluster_select.trigger('change'); - - store_select.val(null); - store_select.empty(); - store_select.prop('disabled', false); - store_select.trigger('change'); - - break; - } - } - - function ClusterChanges (attribute, value) { - let attribute_split_DOM = attribute.split('-'); - let atribut_group_name = attribute_split_DOM[0]; - let postfix = attribute_split_DOM[1]; - let id = attribute_split_DOM[2]; - - let store_select = $('[id*="store-select-' + atribut_group_name + ((postfix !== undefined) ? ('-' + postfix) : '') + ((id !== undefined) ? ('-' + id) : '') + '"]'); - - store_select.empty(); - - store_select.select2({ - data: [stores_in_cluster_array[attribute][value]], - placeholder: 'Выберите магазин', - minimumResultsForSearch: -1 - }); - - store_select.val(null); - - store_select.trigger('change'); - } - - function UpdateClick (attribute_DOM) { - let attribute_split_DOM = attribute_DOM.split('-'); - let atribut_group_name = attribute_split_DOM[0]; - let postfix = attribute_split_DOM[1]; - let id = attribute_split_DOM[2]; - - let date_start = $('input[id*="date-start"][id*="' + attribute_DOM + '"]').val(); - let date_end = $('input[id*="date-end"][id*="' + attribute_DOM + '"]').val(); - let mode = $('select[id*="mode-select"][id*="' + attribute_DOM + '"]').val(); - let cluster = $('select[id*="cluster-select"][id*="' + attribute_DOM + '"]').val(); - let store = $('select[id*="store-select"][id*="' + attribute_DOM + '"]').val(); - let shift = $('select[id*="shift-select"][id*="' + attribute_DOM + '"]').val(); - - if (date_start > date_end) { - return; - } - - $('button[id*="update"][id*="' + attribute_DOM + '"][attribute*="' + attribute_DOM + '"]').prop('disabled', true); - - var csrfToken = $('meta[name="csrf-token"]').attr("content"); - - let data = { - date_start: date_start, - date_end: date_end, - mode: mode, - cluster: cluster, - store: store, - attribute: atribut_group_name, - shift: shift, - _csrf : csrfToken - } - - $.ajax({ - url: '/charts-for-management/get-data-ajax', - method: 'POST', - dataType: 'json', - data: data, - success: function(data) { - ChartUpdate (data.data_answer.attribute, data.chart_opts, atribut_group_name, postfix, id); - $('button[id*="update"][id*="' + attribute_DOM + '"][attribute*="' + attribute_DOM + '"]').trigger('update_series'); - } - }); - } - - function ChartUpdate (data, options, atribut_group_name, postfix, id = '') { - - let data_view = []; - - Object.keys(data).forEach((index) => { - data_view.push(data[index]); - }); - - ApexCharts.exec((atribut_group_name + '-' + postfix + ((id !== '') ? ('-' + id) : '')), 'updateSeries', data_view, false, true); - - if (options !== null) { - ApexCharts.exec((atribut_group_name + '-' + postfix + ((id !== '') ? ('-' + id) : '')), 'updateOptions', options); - } - } - - function CreateChart (chart_type, atribut_group_name, postfix, id = '') { - charts_options[chart_type].chart.id = (atribut_group_name + '-' + postfix + ((id !== '') ? ('-' + id) : '')) - let chart = new ApexCharts(document.querySelector("#chart-panel-" + atribut_group_name + '-' + postfix + ((id !== '') ? ('-' + id) : '')), charts_options[chart_type]); - chart.render(); - - } - - $('input[id*="date-start"], input[id*="date-end"]').on('change', function() { - let attribute_DOM = this.attributes.attribute.value; - - DateChanges (attribute_DOM); - }); - - function UpdateSelectorsDate (date_start, date_end, atribut_group_name, postfix, id = undefined) { - let dates = { - date_start: date_start, - date_end: date_end - }; - - let stores_step; - let clusters; - let stores_in_cluster; - - $.ajax({ - url: '/charts-for-management/get-control-data-ajax', - method: 'POST', - dataType: 'json', - data: dates, - success: function(answer) { - let cluster_select = $('[id*="cluster-select-' + atribut_group_name + ((postfix !== undefined) ? ('-' + postfix) : '') + ((id !== undefined) ? ('-' + id) : '') + '"]'); - let store_select = $('[id*="store-select-' + atribut_group_name + ((postfix !== undefined) ? ('-' + postfix) : '') + ((id !== undefined) ? ('-' + id) : '') + '"]'); - - stores_step = answer.stores_step; - clusters = answer.clusters; - console.log(clusters); - stores_in_cluster = answer.stores_in_cluster; - console.log(stores_in_cluster); - //TODO Костыль - if (atribut_group_name === 'write_offs') { - Object.keys(stores_in_cluster).forEach((cluster_id) => { - Object.keys(stores_in_cluster[cluster_id]['children']).forEach((key) => { - if (stores_in_cluster[cluster_id]['children'][key].id == 4 ) { - stores_in_cluster[cluster_id]['children'][key].text = 'Аэродромная + Доставка' - } - }) - }) - - } - - stores_in_cluster_array[atribut_group_name + ((postfix !== undefined) ? ('-' + postfix) : '') + ((id !== undefined) ? ('-' + id) : '')] = stores_in_cluster; - - - cluster_select.select2({ - data: clusters, - placeholder: 'Выберите куст', - minimumResultsForSearch: -1, - }); - - cluster_select.val(null); - - cluster_select.trigger('change'); - - store_select.val(null); - store_select.empty(); - store_select.trigger('change'); - } - }); - } - - $('select[id*="mode-select"]').on('change', function() { - let attribute = this.attributes.attribute.value; - - ModeChanges (attribute, this.value) - }) - - $('select[id*="cluster-select"]').on('change', function() { - if (this.value === null || this.value === '') { - return; - } - - let attribute = this.attributes.attribute.value; - - ClusterChanges (attribute, this.value); - }); - - $('#update-controls').on('click', function() { - - let date_start = $('input[id*="date-start"][id*="main"]').val(); - let date_end = $('input[id*="date-end"][id*="main"]').val(); - let mode = $('select[id*="mode-select"][id*="main"]').val(); - let cluster = $('select[id*="cluster-select"][id*="main"]').val(); - let store = $('select[id*="store-select"][id*="main"]').val(); - let shift = $('select[id*="shift-select"][id*="main"]').val() - - $('input[id*="date-start"][id*="default"]').val(date_start); - $('input[id*="date-end"][id*="default"]').val(date_end).trigger('change'); - - setTimeout(function() { - $('select[id*="mode-select"][id*="default"]').val(mode).trigger('change'); - $('select[id*="cluster-select"][id*="default"]').val(cluster).trigger('change'); - $('select[id*="store-select"][id*="default"]').val(store).trigger('change'); - $('select[id*="shift-select"][id*="default"]').val(shift).trigger('change'); - }, 1000 / (5)); - - setTimeout(function() { - $('button[id*="update"][id*="default-chart"]').trigger('click'); - }, 1000/(5)) - }); - - $('#date-start-main').val(default_date_start); - $('#date-end-main').val(default_date_end).trigger('change'); - - $('#mode-select-main').trigger('change'); - - $('button[id="update-controls"][attribute="main"]').trigger('click'); - - $('button[id*="update"]:not([attribute*="main"])').on('click', function() { - let attribute_DOM = this.attributes.attribute.value; - - UpdateClick (attribute_DOM); - }); - - $('button[id*="update"]:not([attribute*="main"])').on('update_series', function() { - - let attribute_DOM = this.attributes.attribute.value; - let attribute_split_DOM = attribute_DOM.split('-'); - let atribut_group_name = attribute_split_DOM[0]; - let postfix = attribute_split_DOM[1]; - let id = attribute_split_DOM[2]; - - $('button[id*="update"][id*="' + attribute_DOM + '"][attribute*="' + attribute_DOM + '"]').prop('disabled', false); - }); -JS -); -?> - -
-

- Показатели компании -

-
-

Общая форма

-
-
-
-
-
-
- 'w-40', - 'id' => 'date-start-main', - 'attribute' => 'main' - ] - ) ?> - 'w-40', - 'id' => 'date-end-main', - 'attribute' => 'main' - ] - ) ?> -
-
-
- '', - //'value' => 1, - 'data' => $access['main']['mode_level'], - 'options' => [ - 'id' => 'mode-select-main', - 'style' => 'width:100%', - 'attribute' => 'main' - ], - 'pluginOptions' => [ - 'allowClear' => true, - 'minimumResultsForSearch' => -1 - ], - ]) ?> -
-
- '', - 'data' => [], - 'options' => [ - 'placeholder' => 'Выберите куст', - 'id' => 'cluster-select-main', - 'attribute' => 'main', - 'style' => 'width:100%', - ], - 'pluginOptions' => [ - 'allowClear' => true, - 'minimumResultsForSearch' => -1 - ], - ]) ?> -
-
- '', - 'data' => [], - 'options' => [ - 'placeholder' => 'Выберите магазин', - 'id' => 'store-select-main', - 'style' => 'width:100%', - 'attribute' => 'main' - ], - 'pluginOptions' => [ - 'allowClear' => true, - 'minimumResultsForSearch' => -1 - ], - ]) ?> -
-
-
-
- '', - 'value' => (isset($access['main']['mode_shift'][3]) ? 3 : ((isset($access['main']['mode_shift'][1])) ? 1 : 2)), - 'data' => $access['main']['mode_shift'], - 'options' => [ - 'placeholder' => '', - 'id' => 'shift-select-main', - 'style' => 'width:100%', - 'attribute' => 'main', - - ], - 'pluginOptions' => [ - 'allowClear' => true, - 'minimumResultsForSearch' => -1, - ], - ]) ?> -
-
-
- - -
-
-
-
-
-
-
- -
- render('radial-chart', [ - 'attribute_name' => 'plan_completed_this_day', - 'title' => 'Выполнение плана на текущий день', - 'chart_type' => 'radio_chart_options', - 'access' => $access['plan_completed_this_day'] - ]) ?> -
- - -
- render('radial-chart', [ - 'attribute_name' => 'plan_completed_this_month', - 'title' => 'Выполнение плана на конец месяца', - 'chart_type' => 'radio_chart_options', - 'access' => $access['plan_completed_this_month'] - ]) ?> -
-
- - -
- render('chart', [ - 'attribute_name' => 'sales', - 'title' => 'Продажи', - 'chart_type' => 'default_chart_options', - 'access' => $access['sales'] - ]) ?> -
- - -
- render('chart', [ - 'attribute_name' => 'avg_sales_value', - 'title' => 'Средний чек', - 'chart_type' => 'default_chart_options', - 'access' => $access['avg_sales_value'] - ]) ?> -
- -
- -
- render('chart', [ - 'attribute_name' => 'fot', - 'title' => 'Доля ФОТ', - 'chart_type' => 'fot_chart_options', - 'access' => $access['fot'] - ]) ?> -
- - -
- render('chart', [ - 'attribute_name' => 'sales_sum_on_admin', - 'title' => 'Продажи на сотрудника', - 'chart_type' => 'one_admin_sales_options', - 'access' => $access['sales_sum_on_admin'] - ]) ?> -
- -
- -
- render('users_bonus-chart', [ - 'attribute_name' => 'user_bonus', - 'title' => 'Пользователи бонусной программы', - 'chart_type' => 'count_sales_chart_options', - 'access' => $access['user_bonus'] - ]) ?> -
- -
- render('chart', [ - 'attribute_name' => 'matrix_sales_sum', - 'title' => 'Продажи матрицы', - 'chart_type' => 'matrix_sales_chart_options', - 'access' => $access['matrix_sales_sum'] - ]) ?> -
- -
- render('chart', [ - 'attribute_name' => 'count_sales_in_hour', - 'title' => 'Продажи в час', - 'chart_type' => 'count_sales_in_hour_chart_options', - 'access' => $access['count_sales_in_hour'] - ]) ?> -
- - -
- render('write_offs-chart', [ - 'attribute_name' => 'write_offs', - 'title' => 'Списания', - 'chart_type' => 'write_offs_chart_options', - 'access' => $access['write_offs'] - ]) ?> -
- -
-
-
\ No newline at end of file