--- /dev/null
+<?php
+
+use kartik\grid\GridView;
+use kartik\select2\Select2;
+use yii\helpers\ArrayHelper;
+use yii\helpers\Html;
+use yii_app\helpers\DateHelper;
+use yii_app\records\Admin;
+use yii_app\records\AdminGroup;
+use yii_app\records\StoreCityList;
+use yii_app\records\StoreDynamic;
+use yii_app\records\StoreType;
+use sjaakp\bandoneon\Bandoneon;
+
+/* @var $categories \yii_app\records\Products1cNomenclature */
+
+
+use yii\data\ArrayDataProvider;
+
+$data = [
+ ['Адрес' => '01 Ванеева 181', 'Значение' => 300],
+ ['Адрес' => '02 Плотникова 4', 'Значение' => 300],
+ ['Адрес' => '03 Гагарина 60', 'Значение' => 100],
+ ['Адрес' => '04 Московское шоссе 9а', 'Значение' => 50],
+ ['Адрес' => '05 Белинского 71', 'Значение' => 300],
+ ['Адрес' => '06 Коминтерна 168', 'Значение' => 160],
+ ['Адрес' => '07 Аэродромная', 'Значение' => 300],
+];
+$addresses = array_column($data, 'Адрес');
+$values = array_column($data, 'Значение');
+
+$row = array_combine($addresses, $values);
+$dataProvider = new ArrayDataProvider([
+ 'allModels' => [$row],
+ 'pagination' => false,
+]);
+
+$tooltipText = "Оффлайн: 50 Флаумак (off-line): 20 Флаумак (on-line): 10 Флаумак (market): 10 Изумительная (off-line): 30 Списания: 20";
+
+$columns = [];
+foreach ($addresses as $address) {
+ $columns[] = [
+ 'attribute' => $address,
+ 'label' => $address,
+ 'format' => 'raw',
+ 'headerOptions' => ['style' => 'writing-mode: sideways-lr; text-align: center; white-space: nowrap; font-weight: bold; transform-origin: left bottom; padding-right: 7%;'],
+ 'value' => function ($model, $key, $index) use ($address, $tooltipText) {
+ return '<span style="display: flex; flex-direction: column; gap: 10px;">
+ <span style="display: flex; align-items: center; gap: 5px;">
+ ' . Html::input('text', '', $model[$address], [
+ 'class' => 'btn btn-primary',
+ 'data-bs-toggle' => 'tooltip',
+ 'data-bs-placement' => 'top',
+ 'title' => $tooltipText,
+ 'style' => 'background:#e73535;'
+ ]) . '
+ <button style="border: none; background: transparent; cursor: pointer;">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+ <path d="M20 11v5a1 1 0 0 1-2 0v-4H7.414l1.293 1.293a1 1 0 0 1-1.414 1.414l-3-3a1 1 0 0 1 0-1.416l3-3a1 1 0 0 1 1.414 1.416L7.414 10H19a1 1 0 0 1 1 1z"
+ fill="grey" stroke="none"/>
+ </svg>
+ </button>
+ </span>
+
+ <span style="display: flex; align-items: center; gap: 5px;">
+ ' . Html::input('text', '', $model[$address], [
+ 'class' => 'btn btn-primary',
+ 'data-bs-toggle' => 'tooltip',
+ 'data-bs-placement' => 'top',
+ 'title' => $tooltipText,
+ 'style' => 'background:yellowgreen;'
+ ]) . '
+ <button style="border: none; background: transparent; cursor: pointer;">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+ <path d="M20 11v5a1 1 0 0 1-2 0v-4H7.414l1.293 1.293a1 1 0 0 1-1.414 1.414l-3-3a1 1 0 0 1 0-1.416l3-3a1 1 0 0 1 1.414 1.416L7.414 10H19a1 1 0 0 1 1 1z"
+ fill="red" stroke="none"/>
+ </svg>
+ </button>
+ </span>
+ <span style="display: flex; align-items: center; gap: 5px;">
+ ' . Html::input('text', '', $model[$address], [
+ 'class' => 'btn btn-primary',
+ 'data-bs-toggle' => 'tooltip',
+ 'data-bs-placement' => 'top',
+ 'title' => $tooltipText,
+ 'style' => 'background:#3280cd;'
+ ]) . '
+ <button style="border: none; background: transparent; cursor: pointer;">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+ <path d="M20 11v5a1 1 0 0 1-2 0v-4H7.414l1.293 1.293a1 1 0 0 1-1.414 1.414l-3-3a1 1 0 0 1 0-1.416l3-3a1 1 0 0 1 1.414 1.416L7.414 10H19a1 1 0 0 1 1 1z"
+ fill="red" stroke="none"/>
+ </svg>
+ </button>
+ </span>
+ <span style="display: flex; align-items: center; gap: 5px;">
+ ' . Html::input('text', '', $model[$address], [
+ 'class' => 'btn btn-primary',
+ 'data-bs-toggle' => 'tooltip',
+ 'data-bs-placement' => 'top',
+ 'title' => $tooltipText,
+ 'style' => 'background:yellowgreen;'
+ ]) . '
+ <button style="border: none; background: transparent; cursor: pointer;">
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+ <path d="M20 11v5a1 1 0 0 1-2 0v-4H7.414l1.293 1.293a1 1 0 0 1-1.414 1.414l-3-3a1 1 0 0 1 0-1.416l3-3a1 1 0 0 1 1.414 1.416L7.414 10H19a1 1 0 0 1 1 1z"
+ fill="grey" stroke="none"/>
+ </svg>
+ </button>
+ </span>
+
+
+ </span>';
+ },
+ ];
+}
+?>
+<h1 class="ms-3 mb-4"><?=Html::encode("Автопланограмма")?></h1>
+<div class="autopolnogramma p-3 px-4">
+ <div class="filters">
+ <div class="row">
+ </div>
+ <div class="collapse show" id="filter-container">
+ <div class="row">
+ <div class="col-md d-flex">
+ <?= Select2::widget([
+ 'name' => 'year-filter',
+ 'data' => array_combine(range(date('Y') - 5, date('Y') + 5), range(date('Y') - 5, date('Y') + 5)),
+ 'options' => ['placeholder' => 'Год', 'id' => 'year'],
+ 'pluginOptions' => ['allowClear' => true],
+ ]) ?>
+ </div>
+ <div class="col-md d-flex">
+ <?= Select2::widget([
+ 'name' => 'city-filter',
+ 'data' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_CITY]), 'id', 'name'),
+ 'options' => ['placeholder' => 'Город', 'id' => 'city'],
+ 'pluginOptions' => ['allowClear' => true],
+ ]) ?>
+ </div>
+ <div class="col-md d-flex">
+ <?= Select2::widget([
+ 'name' => 'store-type-filter',
+ 'data' => ArrayHelper::map(StoreType::find()->orderBy('sequence_number')->all(), 'id', 'name'),
+ 'options' => ['placeholder' => 'Тип магазина', 'id' => 'store-type', 'style' => 'width: 110%;'],
+ 'pluginOptions' => ['allowClear' => true],
+ ]) ?>
+ </div>
+ <div class="col-md d-flex">
+ <?= Select2::widget([
+ 'name' => 'territorial-manager-filter',
+ 'data' => ArrayHelper::map(
+ array_merge(
+ Admin::findAll(['group_id' => AdminGroup::GROUP_BUSH_DIRECTOR]),
+ Admin::findAll(['id' => StoreDynamic::find()->andWhere(['category' => 3, 'active' => 1])->select('value_int')->column()])
+ ),
+ 'id',
+ 'name',
+ ),
+ 'options' => ['placeholder' => 'Тер. управляющий', 'id' => 'territorial-manger'],
+ 'pluginOptions' => ['allowClear' => true],
+ ]) ?>
+ </div>
+ <div class="col-md d-flex">
+ <?= Select2::widget([
+ 'name' => 'polnogramma-type-filter',
+ 'data' => ['min' => 'min', 'max' => 'max'],
+ 'options' => ['placeholder' => 'Тип п-ма', 'id' => 'polnogramma-type'],
+ 'pluginOptions' => ['allowClear' => true],
+ ]) ?>
+ </div>
+ <div class="col-md d-flex">
+ <?= Html::submitButton('Применить', ['class' => 'btn btn-apply btn-primary', 'style' => 'width:100%']); ?>
+ </div>
+ </div>
+ <div class="row py-3">
+ <div class="col-md d-flex">
+ <?= Select2::widget([
+ 'name' => 'week-filter',
+ 'data' => ['1' => '1', '2' => '2'],
+ 'options' => ['placeholder' => 'Неделя', 'id' => 'week'],
+ 'pluginOptions' => ['allowClear' => true],
+ ]) ?>
+ </div>
+ <div class="col-md d-flex">
+ <?= Select2::widget([
+ 'name' => 'region-filter',
+ 'data' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_REGION]), 'id', 'name'),
+ 'options' => ['placeholder' => 'Регион', 'id' => 'region'],
+ 'pluginOptions' => ['allowClear' => true],
+ ]) ?>
+ </div>
+ <div class="col-md d-flex">
+ </div>
+ <div class="col-md d-flex">
+ <?= Select2::widget([
+ 'name' => 'bush_chef_florist',
+ 'value' => null,
+ 'data' => ArrayHelper::map(Admin::findAll(['group_id' => AdminGroup::GROUP_BUSH_CHEF_FLORIST]), 'id', 'name'),
+ 'options' => [
+ 'placeholder' => 'Кустовой шеф-флорист',
+ 'class' => 'form-select',
+ 'id' => 'bush_chef_florist',
+ ],
+ 'pluginOptions' => [
+ 'allowClear' => true,
+ ],
+ ]); ?>
+ </div>
+ <div class="col-md d-flex">
+ </div>
+ <div class="col-md d-flex"></div>
+ </div>
+ <div class="row">
+ <div class="col-md d-flex">
+ <?= Html::label('Месяца-месяцы') ?>
+ </div>
+ <div class="col-md d-flex">
+ <?= Select2::widget([
+ 'name' => 'district-filter',
+ 'data' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_DISTRICT]), 'id', 'name'),
+ 'options' => ['placeholder' => 'Район', 'id' => 'district'],
+ 'pluginOptions' => ['allowClear' => true],
+ ]) ?>
+ </div>
+ <div class="col-md d-flex"></div>
+ <div class="col-md d-flex"></div>
+ <div class="col-md d-flex"></div>
+ <div class="col-md d-flex">
+ <?= Html::button('Сохранить', ['class' => 'btn btn-success btn-save', 'style' => 'width:100%']); ?>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-3 py-7">
+ <div class="row">
+
+ <div class="row" style="display: flex;align-items: flex-start; position: relative;">
+ <?= Html::label("год: 2025 неделя: 05") ?><br>
+ <?= Html::label("январь - февраль") ?><br>
+ <?= Html::label("Тип п-ма:") ?><br>
+ <?= Html::label("Город:") ?><br>
+ <?= Html::label("Регион:") ?><br>
+ <?= Html::label("Район:") ?><br>
+ <?= Html::label("Тип магазина:") ?><br>
+ <?= Html::label("Тер. Уп.:") ?><br>
+ <?= Html::label("КШФ:") ?><br>
+
+ <div style="display: flex; flex-direction: column; align-items: flex-end; gap: 5px;">
+ <?= Html::a('Auto', '#', ['class' => 'btn btn-success', 'style' => 'width:25%']) ?>
+ <?= Html::a('Corrected', '#', ['class' => 'btn btn-success', 'style' => 'width:25%']) ?>
+ </div>
+ </div>
+ <div class="row mt-3">
+ <div class="list-group">
+ <?php Bandoneon::begin(); ?>
+
+ <?php foreach ($categories as $category):
+ $subcategories = is_string($category['subcategories'])
+ ? json_decode($category['subcategories'], true)
+ : $category['subcategories']; ?>
+
+ <div class="list-group-item list-group-item-action fw-bold">
+ <?= htmlspecialchars($category['category']) ?>
+ </div>
+
+ <?php if (!empty($subcategories)):
+ Bandoneon::begin();
+ foreach ($subcategories as $subcategory => $products): ?>
+
+ <div class="list-group-item list-group-item-action ms-3 fw-semibold">
+ <?= htmlspecialchars($subcategory) ?>
+ </div>
+
+ <?php if (!empty($products)): ?>
+ <div class="ms-4">
+ <?php foreach ($products as $product): ?>
+ <div class="list-group-item list-group-item-action">
+ <?= htmlspecialchars($product) ?>
+ </div>
+ <?php endforeach; ?>
+ </div>
+ <?php endif; ?>
+
+ <?php endforeach;
+ Bandoneon::end();
+ endif;
+ endforeach; ?>
+
+ <?php Bandoneon::end(); ?>
+ </div>
+ </div>
+
+ </div>
+ </div>
+
+ <div class="col-md-9 text-center">
+ <div class="d-flex justify-content-center">
+ <button class="btn btn-light" type="button" data-bs-toggle="collapse" data-bs-target="#filter-container"
+ aria-expanded="true">
+ <span>▲</span>
+ </button>
+ </div>
+ <?= GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'layout' => '{items}', // Только таблица, без пагинации
+ 'tableOptions' => ['class' => 'table table-bordered mt-2'],
+ 'columns' => $columns,
+ ]);
+
+ ?>
+
+ </div>
+</div>
+</div>
+++ /dev/null
-<?php
-
-use kartik\select2\Select2;
-use yii\helpers\ArrayHelper;
-use yii\helpers\Html;
-use yii_app\records\Admin;
-use yii_app\records\AdminGroup;
-use yii_app\records\StoreCityList;
-use yii_app\records\StoreDynamic;
-use yii_app\records\StoreType;
-use sjaakp\bandoneon\Bandoneon;
-
-?>
-<div class="autopolnogramma p-3">
- <div class="filters">
- <div class="row">
- <?= Html::label('Автополнограмма') ?>
- </div>
- <div class="row">
- <div class="col-md d-flex">
- <?= Select2::widget([
- 'name' => 'year-filter',
- 'data' => array_combine(range(date('Y') - 5, date('Y') + 5), range(date('Y') - 5, date('Y') + 5)),
- 'options' => ['placeholder' => 'Год', 'id' => 'year'],
- 'pluginOptions' => ['allowClear' => true],
- ]) ?>
- </div>
- <div class="col-md d-flex">
- <?= Select2::widget([
- 'name' => 'city-filter',
- 'data' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_CITY]), 'id', 'name'),
- 'options' => ['placeholder' => 'Город', 'id' => 'city'],
- 'pluginOptions' => ['allowClear' => true],
- ]) ?>
- </div>
- <div class="col-md d-flex">
- <?= Select2::widget([
- 'name' => 'store-type-filter',
- 'data' => ArrayHelper::map(StoreType::find()->orderBy('sequence_number')->all(), 'id', 'name'),
- 'options' => ['placeholder' => 'Тип магазина', 'id' => 'store-type', 'style' => 'width: 110%;'],
- 'pluginOptions' => ['allowClear' => true],
- ]) ?>
- </div>
- <div class="col-md d-flex">
- <?= Select2::widget([
- 'name' => 'territorial-manager-filter',
- 'data' => ArrayHelper::map(
- array_merge(
- Admin::findAll(['group_id' => AdminGroup::GROUP_BUSH_DIRECTOR]),
- Admin::findAll(['id' => StoreDynamic::find()->andWhere(['category' => 3, 'active' => 1])->select('value_int')->column()])
- ),
- 'id',
- 'name',
- ),
- 'options' => ['placeholder' => 'Тер. управляющий', 'id' => 'territorial-manger'],
- 'pluginOptions' => ['allowClear' => true],
- ]) ?>
- </div>
- <div class="col-md d-flex">
- <?= Select2::widget([
- 'name' => 'polnogramma-type-filter',
- 'data' => ['min' => 'min', 'max' => 'max'],
- 'options' => ['placeholder' => 'Тип п-ма', 'id' => 'polnogramma-type'],
- 'pluginOptions' => ['allowClear' => true],
- ]) ?>
- </div>
- <div class="col-md d-flex">
- <?= Html::submitButton('Применить', ['class' => 'btn btn-apply btn-primary', 'style' => 'width:100%']);?>
- </div>
- </div>
- <div class="row py-3">
- <div class="col-md d-flex">
- <?= Select2::widget([
- 'name' => 'week-filter',
- 'data' => ['1' => '1', '2' => '2'],
- 'options' => ['placeholder' => 'Неделя', 'id' => 'week'],
- 'pluginOptions' => ['allowClear' => true],
- ]) ?>
- </div>
- <div class="col-md d-flex">
- <?= Select2::widget([
- 'name' => 'region-filter',
- 'data' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_REGION]), 'id', 'name'),
- 'options' => ['placeholder' => 'Регион', 'id' => 'region'],
- 'pluginOptions' => ['allowClear' => true],
- ]) ?>
- </div>
- <div class="col-md d-flex">
-<!-- ttr-->
- </div>
- <div class="col-md d-flex">
- <?= Select2::widget([
- 'name' => 'bush_chef_florist',
- 'value' => null,
- 'data' => ArrayHelper::map(Admin::findAll(['group_id' => AdminGroup::GROUP_BUSH_CHEF_FLORIST]), 'id', 'name'),
- 'options' => [
- 'placeholder' => 'Кустовой шеф-флорист',
- 'class' => 'form-select',
- 'id' => 'bush_chef_florist',
- ],
- 'pluginOptions' => [
- 'allowClear' => true,
- ],
- ]); ?>
- </div>
- <div class="col-md d-flex">
- <!-- ttr-->
- </div>
- <div class="col-md d-flex">
- <?= Html::button('Сохранить', ['class' => 'btn btn-apply btn-save', 'style' => 'width:100%']);?>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-md-5">
- <?php Bandoneon::begin();
- foreach ($categories as $category) {
- echo "<h4>$category->type_num</h4>";
- echo "<div class=\"group-{$category->id}\"></div>";
- }
- Bandoneon::end() ?>
- </div>
- </div>
-
-</div>
\ No newline at end of file