]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
add order_id field to kikFeedbackRequest
authorAlexander Smirnov <fredeom@mail.ru>
Wed, 8 May 2024 11:30:44 +0000 (14:30 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Wed, 8 May 2024 11:30:44 +0000 (14:30 +0300)
erp24/api2/controllers/KikController.php
erp24/records/KikFeedbackRequest.php
erp24/views/kik-feedback/update.php
erp24/views/kik-feedback/view.php

index b3c56bd4b4d2e00703208a972cce34d3ed2b7dbc..b5c6bf538e848ee730ebe457a43b34067c1f5f69 100644 (file)
@@ -29,6 +29,7 @@ class KikController extends BaseController {
         $source_alias = Yii::$app->request->bodyParams['source_alias'];
         $client_info = Yii::$app->request->bodyParams['client_info'];
         $check_id = Yii::$app->request->bodyParams['check_id'] ?? null;
+        $order_id = Yii::$app->request->bodyParams['order_id'] ?? null;
         $store_id = Yii::$app->request->bodyParams['store_id'] ?? null;
 
         $sale = Sales::find()->where(['id' => $check_id])->one();
@@ -36,8 +37,9 @@ class KikController extends BaseController {
         $request = new KikFeedbackRequest;
         $request->name = $client_name;
         $request->phone = $phone;
-        $request->source = ['chatbot' => 8][$source_alias] ?? 0;
+        $request->source = ['chatbot' => 8, 'amocrm' => 10][$source_alias] ?? 0;
         $request->check_id = $check_id;
+        $request->order_id = $order_id;
         $request->store_id = $sale ? $sale->store_id_1c :  ($store_id ?? '');
         $request->client_info = $client_info;
         $request->category = '';
index a47379e7258b463a47930ec0c77c667400c1c73d..faf6af018aea7fc7057c7057779e0f83ec580ff7 100644 (file)
@@ -13,6 +13,7 @@ use yii\helpers\ArrayHelper;
  * @property string $phone Телефон
  * @property int $source ID связанного источника
  * @property string|null $check_id GUID чека
+ * @property string|null $order_id номер заказа в amocrm
  * @property string|null $store_id GUID магазина
  * @property string|null $client_info GUID магазина
  * @property string|null $description Описание
@@ -100,7 +101,7 @@ class KikFeedbackRequest extends \yii\db\ActiveRecord
             [['created_at', 'closed_at', 'responsible', 'comment'], 'safe'],
             [['name'], 'string', 'max' => 255],
             [['client_info', 'management_decision', 'verdict_description'], 'string', 'max' => 1000],
-            [['check_id', 'phone'], 'string', 'max' => 40],
+            [['check_id', 'phone', 'order_id'], 'string', 'max' => 40],
             [['store_id'], 'string', 'max' => 36],
         ];
     }
@@ -116,6 +117,7 @@ class KikFeedbackRequest extends \yii\db\ActiveRecord
             'phone' => 'Телефон',
             'source' => 'Источник',
             'check_id' => 'GUID чека',
+            'order_id' => 'Order Id',
             'client_info' => 'Информация от клиента',
             'store_id' => 'Магазин',
             'description' => 'Описание',
index 869a4ca94f195440eadc017668e3992994ffcd33..6116579061b02d7da0ae5c3d0e09d2906ffb5682 100644 (file)
@@ -56,6 +56,10 @@ $this->registerJsFile('/js/kik-feedback/common.js', ['position' => \yii\web\View
         <?php PrintBlockHelper::printBlock('GUID чека', empty($model->check_id) ? '' : Html::button($model->check_id, ['class' => 'btn btn-primary btn-sm', 'onclick' => 'openSalesWithGuidSearch("' . $model->check_id . '");'])); ?>
     <?php endif; ?>
 
+    <?php if (!empty($model->order_id)): ?>
+        <?php PrintBlockHelper::printBlock('Номер заказа в amocrm', $form->field($model, 'order_id')->textInput()->label(false));?>
+    <?php endif; ?>
+
     <?php PrintBlockHelper::printBlock('Магазин', $form->field($model, 'store_id')->widget(Select2::class, [
         'data' => $cityStores,
         'language' => 'ru',
index 4098342b7bd774831ab6fa611aa3a43e505dedff..4cac6ca173c33948c9661f693754a40c23360a30 100644 (file)
@@ -157,6 +157,11 @@ function drawComplete($model) {
                         'format' => 'raw',
                         'value' => empty($model->check_id) ? '' : Html::button($model->check_id, ['class' => 'btn btn-primary btn-sm', 'onclick' => 'openSalesWithGuidSearch("' . $model->check_id . '");']),
                     ],
+                    [
+                        'label' => 'Номер заказа в amocrm',
+                        'format' => 'raw',
+                        'value' => $model->order_id ?? '',
+                    ],
                     [
                         'label' => 'Магазин',
                         'value' => $model->store->name ?? '',