From 3b80bf4bf840dfd99b97be2f10bc8df59474b4ac Mon Sep 17 00:00:00 2001 From: marina Date: Thu, 27 Feb 2025 10:28:35 +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/controllers/BouquetController.php | 17 ++++++++ erp24/records/BouquetComposition.php | 4 +- erp24/records/BouquetCompositionProducts.php | 3 +- erp24/views/bouquet/_product_edit.php | 2 +- erp24/views/bouquet/_product_list.php | 9 ++++- erp24/views/bouquet/index.php | 42 ++++++++++++++------ erp24/views/bouquet/update.php | 2 +- 7 files changed, 60 insertions(+), 19 deletions(-) diff --git a/erp24/controllers/BouquetController.php b/erp24/controllers/BouquetController.php index dc2aa78e..a3c31f76 100644 --- a/erp24/controllers/BouquetController.php +++ b/erp24/controllers/BouquetController.php @@ -5,6 +5,7 @@ namespace app\controllers; use Exception; use Yii; use yii\db\Expression; +use yii\helpers\ArrayHelper; use yii\helpers\Url; use yii\web\Controller; use yii\web\NotFoundHttpException; @@ -16,6 +17,7 @@ use yii_app\records\{BouquetComposition, CityStore, Files, MatrixType, + Products1cNomenclature, StoreType, WriteOffsErp}; @@ -174,6 +176,21 @@ class BouquetController extends Controller 'marketplace' => $marketplaceList, ]; } + + public function actionGetList() + { + Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; + + $query = Products1cNomenclature::find() + ->andFilterWhere(['size' => Yii::$app->request->post('size')]) + ->andFilterWhere(['type' => Yii::$app->request->post('type')]) + ->andFilterWhere(['species' => Yii::$app->request->post('species')]) + ->andFilterWhere(['color' => Yii::$app->request->post('color')]) + ->andFilterWhere(['category' => Yii::$app->request->post('category')]); + + return ArrayHelper::map($query->all(), 'id', 'name'); + } + public function actionConfirm(int $id): \yii\web\Response { $model = BouquetComposition::findOne($id) ?? throw new NotFoundHttpException('Букет не найден'); diff --git a/erp24/records/BouquetComposition.php b/erp24/records/BouquetComposition.php index 115ebf68..4b08d316 100644 --- a/erp24/records/BouquetComposition.php +++ b/erp24/records/BouquetComposition.php @@ -25,6 +25,7 @@ use yii_app\services\FileService; * @property string|null $date_confirm * @property string|null $date_1c_send * @property string|null $confirm_admin + * @property string|null $error_text * * @property BouquetCompositionProducts[] $bouquetCompositionProducts * @property BouquetCompositionMatrixTypeHistory $matrixType @@ -87,6 +88,7 @@ class BouquetComposition extends ActiveRecord [['created_by', 'updated_by', 'status', 'date_1c_send', 'date_confirm'], 'integer', 'message' => '{attribute} должен быть целым числом'], [['created_at', 'updated_at', 'admin_confirm'], 'safe'], [['guid', 'name'], 'string', 'max' => 255, 'tooLong' => '{attribute} не должен превышать 255 символов'], + [['error_text'], 'string'], [['photo_bouquet'], 'file', 'extensions' => 'jpg, jpeg, png, gif', 'maxFiles' => 10, @@ -116,7 +118,7 @@ class BouquetComposition extends ActiveRecord 'confirm_admin' => 'ID подтвердившего', 'updated_by' => 'ID обновителя записи', 'status' => 'Статус', - + 'error_text' => 'Ошибка', ]; } diff --git a/erp24/records/BouquetCompositionProducts.php b/erp24/records/BouquetCompositionProducts.php index 4156da48..17a280e8 100644 --- a/erp24/records/BouquetCompositionProducts.php +++ b/erp24/records/BouquetCompositionProducts.php @@ -114,8 +114,7 @@ class BouquetCompositionProducts extends ActiveRecord */ public static function getAvailableItems(bool $isNewRecord, ?int $bouquetId = null): array { - $query = Products1c::find() - ->where(['view' => Products1c::IS_VISIBLE, 'tip' => Products1c::TYPE_PRODUCTS]); + $query = Products1cNomenclature::find(); if (!$isNewRecord && $bouquetId) { $selectedIds = self::find() diff --git a/erp24/views/bouquet/_product_edit.php b/erp24/views/bouquet/_product_edit.php index dbf0f56a..3f7d9bf0 100644 --- a/erp24/views/bouquet/_product_edit.php +++ b/erp24/views/bouquet/_product_edit.php @@ -14,7 +14,7 @@ use yii_app\records\BouquetComposition; 'showQuantity' => true, 'listContainerSize' => $listContainerSize, 'triggerButton' => 'apply-button', - 'filterFields' => ['size', 'color', 'species', 'category', 'type-num'] + 'filterFields' => ['size', 'color', 'species', 'category', 'type'] ]) ?>
diff --git a/erp24/views/bouquet/_product_list.php b/erp24/views/bouquet/_product_list.php index c5b5358d..b1985501 100644 --- a/erp24/views/bouquet/_product_list.php +++ b/erp24/views/bouquet/_product_list.php @@ -48,4 +48,11 @@ 'class' => 'btn btn-success btn-edit w-100 mt-4' ]) ?> - \ No newline at end of file + +error_text)): ?> +
+ + error_text) ?> + +
+ diff --git a/erp24/views/bouquet/index.php b/erp24/views/bouquet/index.php index 345b9646..1522737a 100644 --- a/erp24/views/bouquet/index.php +++ b/erp24/views/bouquet/index.php @@ -9,6 +9,7 @@ use yii_app\records\BouquetComposition; use yii_app\records\Files; use yii_app\records\MatrixType; use yii_app\records\Products1c; +use yii_app\records\WriteOffsErp; /** @var yii\web\View $this */ $this->title = 'Содержание матрицы'; @@ -29,21 +30,9 @@ $this->title = 'Содержание матрицы';
-
- request->get('year'), BouquetComposition::getYears(), [ - 'class' => 'form-control', - 'prompt' => 'Год' - ]) ?> -
-
- request->get('month'), \yii_app\helpers\DateHelper::MONTH_NUMBER_NAMES, [ - 'class' => 'form-control', - 'prompt' => 'Месяц' - ]) ?> -
@@ -167,7 +156,34 @@ $this->title = 'Содержание матрицы'; ['style' => 'width: 100%; height: 100%; object-fit: cover;']) . "
- +
+
+ " . (!empty($model->status) ? " + + 'bg-success', + WriteOffsErp::STATUS_SEND => 'bg-warning', + WriteOffsErp::STATUS_DISABLE, + WriteOffsErp::STATUS_ERROR_1С => 'bg-danger', + default => 'bg-secondary', + } . + " fs-6 text-white px-7 w-100 mb-4 d-block'> + " . Html::encode(\yii_app\records\WriteOffsErp::STATUSES[$model->status] ?? '') . " + + " : "") . " +
+ " . (!empty($model->error_text) ? " +
+ + + " . Html::encode($model->error_text) . " + +
+ " : "") . " +
diff --git a/erp24/views/bouquet/update.php b/erp24/views/bouquet/update.php index 6c9c7460..6fc7ae1e 100644 --- a/erp24/views/bouquet/update.php +++ b/erp24/views/bouquet/update.php @@ -41,7 +41,7 @@ $this->registerJsFile('/js/bouquet/bouquet.js', ['position' => \yii\web\View::PO select('species')->distinct()->column(), ['class' => 'form-select', 'prompt' => 'Выберите вид', 'id' => 'species']) ?>
- select('type_num')->distinct()->column(), ['class' => 'form-select', 'prompt' => 'Выберите тип', 'id' => 'type_num']) ?> + select('type')->distinct()->column(), ['class' => 'form-select', 'prompt' => 'Выберите тип', 'id' => 'type']) ?>
select('size')->distinct()->column(), ['class' => 'form-select', 'prompt' => 'Выберите размер', 'id' => 'size']) ?> -- 2.39.5