From: marina Date: Wed, 19 Feb 2025 12:26:34 +0000 (+0300) Subject: ERP-302 Редактирование букета X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=d0fa82837a803abc447a49362d3c983bbcc0c381;p=erp24_rep%2Fyii-erp24%2F.git ERP-302 Редактирование букета --- diff --git a/erp24/controllers/BouquetController.php b/erp24/controllers/BouquetController.php index d7015e4a..2a67a63d 100644 --- a/erp24/controllers/BouquetController.php +++ b/erp24/controllers/BouquetController.php @@ -231,7 +231,7 @@ class BouquetController extends Controller if (Yii::$app->request->isPost) { try { - if (array_key_exists('products_quantity', Yii::$app->request->post())) { + if (Yii::$app->request->post('products_quantity')) { $bouquetProducts = Yii::$app->request->post('products_quantity'); foreach ($bouquetProducts as $key => $value) { $product = new BouquetCompositionProducts([ @@ -242,14 +242,13 @@ class BouquetController extends Controller $product->save(); } - return $this->redirect('view', [ - 'model' => $model - ]); + return $this->redirect(['view', 'id' => $id]); } } catch (Exception $exception) { - throw new NotFoundHttpException($exception); + throw new NotFoundHttpException($exception->getMessage()); } } + $products = BouquetCompositionProducts::find() ->where(['bouquet_id' => $model->id]) ->with('product') diff --git a/erp24/views/bouquet/_form.php b/erp24/views/bouquet/_form.php index 9cb3cfd8..afeb9b5b 100644 --- a/erp24/views/bouquet/_form.php +++ b/erp24/views/bouquet/_form.php @@ -73,7 +73,8 @@ $form = ActiveForm::begin([
@@ -89,7 +90,7 @@ $form = ActiveForm::begin([
ср.шт. в сборке
-
+
product->name ?>
@@ -101,20 +102,21 @@ $form = ActiveForm::begin([
-
-
- Нижегородская область -
- - Себестоимость: getSelfCost()?>
- Наценка: getMarkUp() ?>
- Цена: getCost() ?>
+ +
+
+ Нижегородская область +
+ Себестоимость: getSelfCost() ?>
+ Наценка: getMarkUp() ?>
+ Цена: getCost() ?>
+
+
+
+ id"), ['class' => $model ? 'btn btn-warning w-100' : 'btn btn-warning w-100 disabled']) ?>
-
- id") : Url::to("#"), ['class' => $model ? 'btn btn-warning w-100' : 'btn btn-warning w-100 disabled']) ?> -
-
+