]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Обновление информации о загрузке
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 25 Apr 2025 13:59:53 +0000 (16:59 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 25 Apr 2025 13:59:53 +0000 (16:59 +0300)
erp24/media/controllers/MarketplaceController.php
erp24/media/views/marketplace/upload.php

index 1942b4ed23c0ec1f618584f2d4ff72ca7fecfeca..7927b556f0c277ede4ed82a413d4aebc601b100f 100644 (file)
@@ -61,15 +61,18 @@ class MarketplaceController extends Controller
     public function actionUpload()
     {
         Yii::$app->response->format = Response::FORMAT_HTML;
-        $guid = Yii::$app->request->get('guid') ?? Yii::$app->request->post('guid');
-        //var_dump($guid); die();
+        $guid = Yii::$app->request->get('guid');
+
         if (!$guid) {
-            return $this->redirect(['/']);
+            return $this->render('upload.php', [
+                'guid' => null,
+            ]);
         }
+
         $entity = MarketplaceOrders::PHOTO_ORDER;
         $type = MarketplaceOrders::PHOTO_TYPE;
         $order = MarketplaceOrders::find()->where(['guid' => $guid])->one();
-       // var_dump($order); die();
+
         if (!$order) {
             throw new \yii\web\NotFoundHttpException("Заказ не найден.");
         }
index 92275590300e1a499a6ee6c885377b0b38f449b8..82f6159eaa668c669cfff0fbd09ebce4b82c2aaa 100644 (file)
@@ -1,33 +1,42 @@
 <?php
+
 use yii\widgets\ActiveForm;
 use yii\helpers\Html;
 
 /** @var $this yii\web\View */
 /** @var string $guid */
-
-$this->title = 'Загрузка фотографий заказа (GUID: ' . $guid . ')';
+$order = \yii_app\records\MarketplaceOrders::find()->where(['guid' => $guid])->one();
+$this->title = $guid ? 'Загрузка фотографий заказа c ' . $order->marketplace_name . ' (Заказ: ' . $order->marketplace_order_id . ')' :
+    'Загрузка недоступна';
 ?>
 
     <div class="upload-wrapper">
         <div class="upload-form">
-            <h1><?= Html::encode($this->title) ?></h1>
+            <?php if (!$guid): ?>
+                <h1><?= Html::encode($this->title) ?></h1>
+                <p style="text-align: center; margin-top: 20px;">
+                    Пожалуйста, перейдите по QR-коду для загрузки фотографий.
+                </p>
+            <?php else: ?>
+                <h1><?= Html::encode($this->title) ?></h1>
 
-            <?php if (Yii::$app->session->hasFlash('success')): ?>
-                <div class="alert alert-success">
-                    <?= Yii::$app->session->getFlash('success') ?>
-                </div>
-            <?php endif; ?>
+                <?php if (Yii::$app->session->hasFlash('success')): ?>
+                    <div class="alert alert-success">
+                        <?= Yii::$app->session->getFlash('success') ?>
+                    </div>
+                <?php endif; ?>
 
-            <form action="/marketplace/upload" method="post" enctype="multipart/form-data">
-                <input type="hidden" name="guid" value="<?= $guid ?>">
+                <form action="/marketplace/upload" method="post" enctype="multipart/form-data">
+                    <input type="hidden" name="guid" value="<?= $guid ?>">
 
-                <div class="form-group">
-                    <label for="files">Выберите файлы</label>
-                    <input type="file" name="files[]" id="files" multiple>
-                </div>
+                    <div class="form-group">
+                        <label for="files">Выберите файлы</label>
+                        <input type="file" name="files[]" id="files" multiple>
+                    </div>
 
-                <button type="submit">Загрузить</button>
-            </form>
+                    <button type="submit">Загрузить</button>
+                </form>
+            <?php endif; ?>
         </div>
     </div>
 
@@ -94,5 +103,6 @@ $this->registerCss(<<<CSS
     margin-bottom: 16px;
     text-align: center;
 }
-CSS);
+CSS
+);
 ?>
\ No newline at end of file