use OpenAPI\Client\Api;
use OpenAPI\Client\Model;
use GuzzleHttp;
+use yii\web\Response;
+use yii_app\records\MarketplaceOrders;
+use yii_app\records\MarketplaceOrderStatusHistory;
+use yii_app\records\MarketplaceOrderStatusTypes;
+use yii_app\records\MarketplaceStore;
use yii_app\records\MatrixErp;
use yii_app\records\Products1c;
use yii_app\services\MarketplaceService;
return "<div style='margin: 1rem;'>" . $output . "</div>";
}
-}
\ No newline at end of file
+
+ public function actionGetOrders()
+ {
+ Yii::$app->response->format = Response::FORMAT_JSON;
+ $config = Configuration::getDefaultConfiguration()
+ ->setApiKey('Api-Key', Yii::$app->params['YANDEX_MARKET_API_KEY']);
+
+ $campaignIds = MarketplaceStore::find()
+ ->select(['warehouse_guid'])
+ ->where(['warehouse_id' => 2])
+ ->column();
+
+ $statuses = MarketplaceOrderStatusTypes::find()
+ ->select(['id', 'code'])
+ ->indexBy('code')
+ ->asArray()->all();
+
+ $statuses = ArrayHelper::map($statuses, 'code', 'id');
+ $statusCodes = array_unique(array_keys($statuses));
+ // var_dump($statusCodes);die();
+
+
+ $apiInstance = new Api\OrdersApi(new GuzzleHttp\Client(), $config);
+ //$apiModel = new Model\GetOrdersResponse();
+
+ foreach ($campaignIds as $campaignId) {
+ $result = $apiInstance->getOrdersWithHttpInfo($campaignId);
+ $pager = $result[0]->getPager();
+ if (empty($pager->getTotal())) {
+ continue;
+ }
+
+ $orders = $result[0]->getOrders();
+ foreach ($orders as $order) {
+ // var_dump($statusCodes);die();
+ // Установка и сохранение статусов
+ $status = $statuses[$order->getStatus()] ?? null;
+ $substatus = $statuses[$order->getSubstatus()] ?? null;
+ if (!in_array($order->getStatus(), $statusCodes)) {
+ $newStatus = new MarketplaceOrderStatusTypes();
+ $newStatus->code = $order->getStatus();
+ if ($newStatus->save()) {
+ $status = $newStatus->id;
+ $statusCodes[] = $order->getStatus();
+ $statuses[$order->getStatus()] = $newStatus->id;
+ } else {
+ Yii::error('Ошибка сохранения' . json_encode($newStatus->getErrors(), JSON_UNESCAPED_UNICODE));
+ }
+ }
+ if (!in_array($order->getSubstatus(), $statusCodes)) {
+ $newSubstatus = new MarketplaceOrderStatusTypes();
+ $newSubstatus->code = $order->getSubstatus();
+ if ($newSubstatus->save()) {
+ $substatus = $newSubstatus->id;
+ $statusCodes[] = $order->getSubstatus();
+ $statuses[$order->getSubstatus()] = $newStatus->id;
+ } else {
+ Yii::error('Ошибка сохранения' . json_encode($newSubstatus->getErrors(), JSON_UNESCAPED_UNICODE));
+ }
+ }
+ $marketplaceOrder = MarketplaceOrders::find()->where(['marketplace_id' => (string)$order->getId()])->one();
+
+ if (!empty($marketplaceOrder)) {
+ $statusHistoryRecord = MarketplaceOrderStatusHistory::find()
+ ->where(['id' => $marketplaceOrder->status_history_id])
+ ->one();
+ if(!empty($statusHistoryRecord) && ($statusHistoryRecord->status_id !== $status || $statusHistoryRecord->substatus_id !== $substatus)) {
+ $statusHistoryRecord->active = 0;
+ $statusHistoryRecord->date_to = date();
+ $statusHistoryRecord->save();
+
+ $newStatusHistoryRecord = new MarketplaceOrderStatusHistory();
+ $newStatusHistoryRecord->order_id = $marketplaceOrder->id;
+ $newStatusHistoryRecord->status_id = (int)$status;
+ $newStatusHistoryRecord->substatus_id = (int)$substatus;
+ $newStatusHistoryRecord->active = 1;
+ $newStatusHistoryRecord->initiator = "ERP";
+ $newStatusHistoryRecord->date_from = date();
+ $newStatusHistoryRecord->date_end = date('Y-m-d H:i:s',strtotime("2100-01-01"));
+ if (!$newStatusHistoryRecord->save()) {
+ Yii::error('Ошибка сохранения' . json_encode($newStatusHistoryRecord->getErrors(), JSON_UNESCAPED_UNICODE));
+ } else {
+ $marketplaceOrder->status_history_id = $newStatusHistoryRecord->id;
+ }
+ }
+ } else {
+ $marketplaceOrder = new MarketplaceOrders();
+ $marketplaceOrder->marketplace_id = (string)$order->getId();
+ //var_dump((int)$order->getCancelRequested()); die();
+ $creationDate = strtotime($order->getCreationDate());
+ if ($creationDate !== false) {
+ $marketplaceOrder->creation_date = date('Y-m-d H:i:s', $creationDate);
+ } else {
+ Yii::error("Неверный формат даты: " . $order->getCreationDate());
+ }
+ $updatedAt = strtotime($order->getUpdatedAt());
+ if ($updatedAt !== false) {
+ $marketplaceOrder->updated_at = date('Y-m-d H:i:s', $updatedAt);
+ } else {
+ Yii::error("Неверный формат даты: " . $order->getUpdatedAt());
+ }
+ $marketplaceOrder->total = $order->getBuyerTotal();
+ $marketplaceOrder->delivery_total = $order->getDeliveryTotal();
+ $marketplaceOrder->buyer_total_before_discount = $order->getBuyerTotalBeforeDiscount();
+ $marketplaceOrder->tax_system = $order->getTaxSystem();
+ $marketplaceOrder->payment_type = $order->getPaymentType();
+ $marketplaceOrder->payment_method = $order->getPaymentMethod();
+ $marketplaceOrder->cancel_requested = (int)$order->getCancelRequested();
+ $marketplaceOrder->store_id = (string)$campaignId;
+ $marketplaceOrder->raw_data = json_encode($order);
+
+ if (!$marketplaceOrder->save()) {
+ Yii::error(
+ "Ошибка сохранения заказа с marketplace_id: " . $order->getId() . ". Ошибки: " . json_encode(
+ $marketplaceOrder->getErrors(), JSON_UNESCAPED_UNICODE
+ )
+ );
+ } else {
+ $newStatusHistoryRecord = new MarketplaceOrderStatusHistory();
+ $newStatusHistoryRecord->order_id = $marketplaceOrder->id;
+ $newStatusHistoryRecord->status_id = (int)$status;
+ $newStatusHistoryRecord->substatus_id = (int)$substatus;
+ $newStatusHistoryRecord->active = 1;
+ $newStatusHistoryRecord->initiator = "ERP";
+ $newStatusHistoryRecord->date_from = date('Y-m-d H:i:s');
+ $newStatusHistoryRecord->date_end = date('Y-m-d H:i:s',strtotime("2100-01-01"));
+ if (!$newStatusHistoryRecord->save()) {
+ Yii::error('Ошибка сохранения' . json_encode($newStatusHistoryRecord->getErrors(), JSON_UNESCAPED_UNICODE));
+ } else {
+ $marketplaceOrder->status_history_id = $newStatusHistoryRecord->id;
+ if (!$marketplaceOrder->save()) {
+ Yii::error(
+ "Ошибка сохранения заказа с marketplace_id: " . $order->getId() . ". Ошибки: " . json_encode(
+ $marketplaceOrder->getErrors(), JSON_UNESCAPED_UNICODE
+ )
+ );
+ }
+ }
+ }
+ }
+ }
+ }
+ return json_encode(["response" => "OK"]);
+ }
+
+}
--- /dev/null
+<?php
+
+namespace app\controllers;
+
+use yii_app\records\MarketplaceOrderDelivery;
+use yii_app\records\MarketplaceOrderDeliverySearch;
+use yii\web\Controller;
+use yii\web\NotFoundHttpException;
+use yii\filters\VerbFilter;
+
+/**
+ * MarketplaceOrderDeliveryController implements the CRUD actions for MarketplaceOrderDelivery model.
+ */
+class MarketplaceOrderDeliveryController extends Controller
+{
+ /**
+ * @inheritDoc
+ */
+ public function behaviors()
+ {
+ return array_merge(
+ parent::behaviors(),
+ [
+ 'verbs' => [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ]
+ );
+ }
+
+ /**
+ * Lists all MarketplaceOrderDelivery models.
+ *
+ * @return string
+ */
+ public function actionIndex()
+ {
+ $searchModel = new MarketplaceOrderDeliverySearch();
+ $dataProvider = $searchModel->search($this->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single MarketplaceOrderDelivery model.
+ * @param int $id ID записи
+ * @return string
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new MarketplaceOrderDelivery model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return string|\yii\web\Response
+ */
+ public function actionCreate()
+ {
+ $model = new MarketplaceOrderDelivery();
+
+ if ($this->request->isPost) {
+ if ($model->load($this->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->id]);
+ }
+ } else {
+ $model->loadDefaultValues();
+ }
+
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Updates an existing MarketplaceOrderDelivery model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param int $id ID записи
+ * @return string|\yii\web\Response
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($this->request->isPost && $model->load($this->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->id]);
+ }
+
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Deletes an existing MarketplaceOrderDelivery model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param int $id ID записи
+ * @return \yii\web\Response
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the MarketplaceOrderDelivery model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param int $id ID записи
+ * @return MarketplaceOrderDelivery the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = MarketplaceOrderDelivery::findOne(['id' => $id])) !== null) {
+ return $model;
+ }
+
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+}
--- /dev/null
+<?php
+
+namespace app\controllers;
+
+use yii_app\records\MarketplaceOrderStatusHistory;
+use yii_app\records\MarketplaceOrderStatusHistorySearch;
+use yii\web\Controller;
+use yii\web\NotFoundHttpException;
+use yii\filters\VerbFilter;
+
+/**
+ * MarketplaceOrderStatusHistoryController implements the CRUD actions for MarketplaceOrderStatusHistory model.
+ */
+class MarketplaceOrderStatusHistoryController extends Controller
+{
+ /**
+ * @inheritDoc
+ */
+ public function behaviors()
+ {
+ return array_merge(
+ parent::behaviors(),
+ [
+ 'verbs' => [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ]
+ );
+ }
+
+ /**
+ * Lists all MarketplaceOrderStatusHistory models.
+ *
+ * @return string
+ */
+ public function actionIndex()
+ {
+ $searchModel = new MarketplaceOrderStatusHistorySearch();
+ $dataProvider = $searchModel->search($this->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single MarketplaceOrderStatusHistory model.
+ * @param int $id ID записи
+ * @return string
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new MarketplaceOrderStatusHistory model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return string|\yii\web\Response
+ */
+ public function actionCreate()
+ {
+ $model = new MarketplaceOrderStatusHistory();
+
+ if ($this->request->isPost) {
+ if ($model->load($this->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->id]);
+ }
+ } else {
+ $model->loadDefaultValues();
+ }
+
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Updates an existing MarketplaceOrderStatusHistory model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param int $id ID записи
+ * @return string|\yii\web\Response
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($this->request->isPost && $model->load($this->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->id]);
+ }
+
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Deletes an existing MarketplaceOrderStatusHistory model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param int $id ID записи
+ * @return \yii\web\Response
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the MarketplaceOrderStatusHistory model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param int $id ID записи
+ * @return MarketplaceOrderStatusHistory the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = MarketplaceOrderStatusHistory::findOne(['id' => $id])) !== null) {
+ return $model;
+ }
+
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+}
--- /dev/null
+<?php
+
+namespace app\controllers;
+
+use yii_app\records\MarketplaceOrderStatusTypes;
+use yii_app\records\MarketplaceOrderStatusTypesSearch;
+use yii\web\Controller;
+use yii\web\NotFoundHttpException;
+use yii\filters\VerbFilter;
+
+/**
+ * MarketplaceOrderStatusTypesController implements the CRUD actions for MarketplaceOrderStatusTypes model.
+ */
+class MarketplaceOrderStatusTypesController extends Controller
+{
+ /**
+ * @inheritDoc
+ */
+ public function behaviors()
+ {
+ return array_merge(
+ parent::behaviors(),
+ [
+ 'verbs' => [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ]
+ );
+ }
+
+ /**
+ * Lists all MarketplaceOrderStatusTypes models.
+ *
+ * @return string
+ */
+ public function actionIndex()
+ {
+ $searchModel = new MarketplaceOrderStatusTypesSearch();
+ $dataProvider = $searchModel->search($this->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single MarketplaceOrderStatusTypes model.
+ * @param int $id ID статуса
+ * @return string
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new MarketplaceOrderStatusTypes model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return string|\yii\web\Response
+ */
+ public function actionCreate()
+ {
+ $model = new MarketplaceOrderStatusTypes();
+
+ if ($this->request->isPost) {
+ if ($model->load($this->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->id]);
+ }
+ } else {
+ $model->loadDefaultValues();
+ }
+
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Updates an existing MarketplaceOrderStatusTypes model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param int $id ID статуса
+ * @return string|\yii\web\Response
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($this->request->isPost && $model->load($this->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->id]);
+ }
+
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Deletes an existing MarketplaceOrderStatusTypes model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param int $id ID статуса
+ * @return \yii\web\Response
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the MarketplaceOrderStatusTypes model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param int $id ID статуса
+ * @return MarketplaceOrderStatusTypes the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = MarketplaceOrderStatusTypes::findOne(['id' => $id])) !== null) {
+ return $model;
+ }
+
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+}
--- /dev/null
+<?php
+
+namespace app\controllers;
+
+use yii_app\records\MarketplaceOrders;
+use yii_app\records\MarketplaceOrdersSearch;
+use yii\web\Controller;
+use yii\web\NotFoundHttpException;
+use yii\filters\VerbFilter;
+
+/**
+ * MarketplaceOrdersController implements the CRUD actions for MarketplaceOrders model.
+ */
+class MarketplaceOrdersController extends Controller
+{
+ /**
+ * @inheritDoc
+ */
+ public function behaviors()
+ {
+ return array_merge(
+ parent::behaviors(),
+ [
+ 'verbs' => [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ]
+ );
+ }
+
+ /**
+ * Lists all MarketplaceOrders models.
+ *
+ * @return string
+ */
+ public function actionIndex()
+ {
+ $searchModel = new MarketplaceOrdersSearch();
+ $dataProvider = $searchModel->search($this->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single MarketplaceOrders model.
+ * @param int $id ID заказа
+ * @return string
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new MarketplaceOrders model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return string|\yii\web\Response
+ */
+ public function actionCreate()
+ {
+ $model = new MarketplaceOrders();
+
+ if ($this->request->isPost) {
+ if ($model->load($this->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->id]);
+ }
+ } else {
+ $model->loadDefaultValues();
+ }
+
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Updates an existing MarketplaceOrders model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param int $id ID заказа
+ * @return string|\yii\web\Response
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($this->request->isPost && $model->load($this->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->id]);
+ }
+
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Deletes an existing MarketplaceOrders model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param int $id ID заказа
+ * @return \yii\web\Response
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the MarketplaceOrders model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param int $id ID заказа
+ * @return MarketplaceOrders the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = MarketplaceOrders::findOne(['id' => $id])) !== null) {
+ return $model;
+ }
+
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+}
public const VAT_0 = 'VAT_0';
+ public const VAT_05 = 'VAT_05';
+
public const VAT_10 = 'VAT_10';
public const VAT_10_110 = 'VAT_10_110';
return [
self::NO_VAT,
self::VAT_0,
+ self::VAT_05,
self::VAT_10,
self::VAT_10_110,
self::VAT_20,
--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%marketplace_orders}}`.
+ */
+class m250219_062708_create_marketplace_orders_table extends Migration
+{
+ const TABLE_NAME = 'erp24.marketplace_orders';
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+ if (!isset($tableSchema)) {
+ $this->createTable(self::TABLE_NAME, [
+ 'id' => $this->bigPrimaryKey()->comment('ID заказа'),
+ 'marketplace_id' => $this->string(64)->notNull()->unique()->comment('ID заказа в системе маркетплейса'),
+ 'store_id' => $this->string(36)->comment('Идентификатор склада/магазина'),
+ 'status_history_id' => $this->bigInteger()->comment('Ссылка на текущий активный статус'),
+ 'creation_date' => $this->dateTime()->notNull()->comment('Дата создания заказа'),
+ 'updated_at' => $this->dateTime()->notNull()->comment('Время последнего обновления'),
+ 'total' => $this->decimal(15, 2)->notNull()->comment('Итоговая сумма к оплате'),
+ 'delivery_total' => $this->decimal(15, 2)->notNull()->comment('Стоимость доставки'),
+ 'buyer_total_before_discount' => $this->decimal(15, 2)->notNull()->comment('Сумма до скидок'),
+ 'tax_system' => $this->string(32)->notNull()->comment('Система налогообложения'),
+ 'payment_type' => $this->string(32)->notNull()->comment('Тип платежа'),
+ 'payment_method' => $this->string(32)->notNull()->comment('Метод оплаты'),
+ 'cancel_requested' => $this->tinyInteger()->notNull()->defaultValue(0)->comment('Флаг запроса отмены'),
+ 'raw_data' => $this->text()->comment('Полный сырой ответ API'),
+ 'guid' => $this->string(36)->null()->comment('GUID заказа в 1С'),
+ 'status_1c' => $this->integer()->defaultValue(1)->comment('Статус заказа в 1С'),
+ ]);
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+
+ if (isset($tableSchema)) {
+ $this->dropTable(self::TABLE_NAME);
+ }
+ }
+}
--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%marketplace_order_status_types}}`.
+ */
+class m250219_081610_create_marketplace_order_status_types_table extends Migration
+{
+ const TABLE_NAME = 'erp24.marketplace_order_status_types';
+
+ public function safeUp()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+ if (!isset($tableSchema)) {
+ $this->createTable(self::TABLE_NAME, [
+ 'id' => $this->primaryKey()->comment('ID статуса'),
+ 'code' => $this->string(64)->notNull()->comment('Код статуса'),
+ 'name' => $this->string(255)->null()->comment('Название статуса'),
+ 'description' => $this->string()->null()->comment('Описание статуса'),
+ ]);
+ }
+ }
+
+ public function safeDown()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+
+ if (isset($tableSchema)) {
+ $this->dropTable(self::TABLE_NAME);
+ }
+ }
+}
--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%marketplace_order_status_history}}`.
+ */
+class m250219_081716_create_marketplace_order_status_history_table extends Migration
+{
+ const TABLE_NAME = 'erp24.marketplace_order_status_history';
+
+ public function safeUp()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+ if (!isset($tableSchema)) {
+ $this->createTable(self::TABLE_NAME, [
+ 'id' => $this->bigPrimaryKey()->comment('ID записи'),
+ 'order_id' => $this->bigInteger()->notNull()->comment('Ссылка на заказ'),
+ 'status_id' => $this->integer()->notNull()->comment('Ссылка на тип статуса'),
+ 'substatus_id' => $this->integer()->notNull()->comment('Ссылка на подстатус'),
+ 'active' => $this->integer(1)->notNull()->defaultValue(1)->comment('Активность записи'),
+ 'date_from' => $this->dateTime()->notNull()->comment('Дата и время начала активности'),
+ 'date_end' => $this->dateTime()->null()->comment('Дата и время окончания активности'),
+ 'initiator' => $this->text()->comment('Инициатор изменения'),
+ ]);
+
+ $this->addForeignKey(
+ 'fk_order_status_history_order',
+ self::TABLE_NAME,
+ 'order_id',
+ 'marketplace_orders',
+ 'id',
+ 'SET NULL',
+ 'CASCADE'
+ );
+
+ $this->addForeignKey(
+ 'fk_order_status_history_status',
+ self::TABLE_NAME,
+ 'status_id',
+ 'marketplace_order_status_types',
+ 'id',
+ 'RESTRICT',
+ 'CASCADE'
+ );
+
+ $this->addForeignKey(
+ 'fk_order_status_history_substatus',
+ self::TABLE_NAME,
+ 'substatus_id',
+ 'marketplace_order_status_types',
+ 'id',
+ 'SET NULL',
+ 'CASCADE'
+ );
+ }
+ }
+
+ public function safeDown()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+
+ if (isset($tableSchema)) {
+ $this->dropTable(self::TABLE_NAME);
+ }
+ }
+}
--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%marketplace_order_delivery}}`.
+ */
+class m250219_082141_create_marketplace_order_delivery_table extends Migration
+{
+ const TABLE_NAME = 'erp24.marketplace_order_delivery';
+
+ public function safeUp()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+ if (!isset($tableSchema)) {
+ $this->createTable(self::TABLE_NAME, [
+ 'id' => $this->bigPrimaryKey()->comment('ID записи'),
+ 'order_id' => $this->bigInteger()->notNull()->comment('Ссылка на заказ'),
+ 'type' => $this->string(32)->notNull()->comment('Тип доставки'),
+ 'service_name' => $this->string(64)->notNull()->comment('Название службы доставки'),
+ 'partner_type' => $this->string(32)->notNull()->comment('Тип партнера доставки'),
+ 'country' => $this->string(64)->notNull()->comment('Страна'),
+ 'postcode' => $this->string(16)->notNull()->comment('Индекс'),
+ 'city' => $this->string(128)->notNull()->comment('Город'),
+ 'street' => $this->string(255)->notNull()->comment('Улица'),
+ 'house' => $this->string(16)->notNull()->comment('Дом'),
+ 'apartment' => $this->string(16)->null()->comment('Квартира'),
+ 'latitude' => $this->decimal(10, 6)->notNull()->comment('Широта'),
+ 'longitude' => $this->decimal(10, 6)->notNull()->comment('Долгота'),
+ 'delivery_start' => $this->dateTime()->null()->comment('Начало периода доставки'),
+ 'delivery_end' => $this->dateTime()->null()->comment('Конец периода доставки'),
+ 'courier_full_name' => $this->string(255)->null()->comment('ФИО курьера'),
+ 'courier_phone' => $this->string(32)->null()->comment('Телефон курьера'),
+ 'courier_extension' => $this->string(16)->null()->comment('Дополнительный номер курьера'),
+ 'courier_vehicle_number' => $this->string(32)->null()->comment('Номер автомобиля курьера'),
+ 'courier_vehicle_description' => $this->string(255)->null()->comment('Описание автомобиля курьера'),
+ ]);
+
+ $this->addForeignKey(
+ 'fk_order_delivery_order',
+ self::TABLE_NAME,
+ 'order_id',
+ 'marketplace_orders',
+ 'id',
+ 'SET NULL',
+ 'CASCADE'
+ );
+ }
+ }
+
+ public function safeDown()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+
+ if (isset($tableSchema)) {
+ $this->dropTable(self::TABLE_NAME);
+ }
+ }
+}
--- /dev/null
+<?php
+
+namespace yii_app\records;
+
+use Yii;
+
+/**
+ * This is the model class for table "marketplace_order_delivery".
+ *
+ * @property int $id ID записи
+ * @property int $order_id Ссылка на заказ
+ * @property string $type Тип доставки
+ * @property string $service_name Название службы доставки
+ * @property string $partner_type Тип партнера доставки
+ * @property string $country Страна
+ * @property string $postcode Индекс
+ * @property string $city Город
+ * @property string $street Улица
+ * @property string $house Дом
+ * @property string|null $apartment Квартира
+ * @property float $latitude Широта
+ * @property float $longitude Долгота
+ * @property string|null $delivery_start Начало периода доставки
+ * @property string|null $delivery_end Конец периода доставки
+ * @property string|null $courier_full_name ФИО курьера
+ * @property string|null $courier_phone Телефон курьера
+ * @property string|null $courier_extension Дополнительный номер курьера
+ * @property string|null $courier_vehicle_number Номер автомобиля курьера
+ * @property string|null $courier_vehicle_description Описание автомобиля курьера
+ *
+ * @property MarketplaceOrders $order
+ */
+class MarketplaceOrderDelivery extends \yii\db\ActiveRecord
+{
+
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function tableName()
+ {
+ return 'marketplace_order_delivery';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function rules()
+ {
+ return [
+ [['apartment', 'delivery_start', 'delivery_end', 'courier_full_name', 'courier_phone', 'courier_extension', 'courier_vehicle_number', 'courier_vehicle_description'], 'default', 'value' => null],
+ [['order_id', 'type', 'service_name', 'partner_type', 'country', 'postcode', 'city', 'street', 'house', 'latitude', 'longitude'], 'required'],
+ [['order_id'], 'default', 'value' => null],
+ [['order_id'], 'integer'],
+ [['latitude', 'longitude'], 'number'],
+ [['delivery_start', 'delivery_end'], 'safe'],
+ [['type', 'partner_type', 'courier_phone', 'courier_vehicle_number'], 'string', 'max' => 32],
+ [['service_name', 'country'], 'string', 'max' => 64],
+ [['postcode', 'house', 'apartment', 'courier_extension'], 'string', 'max' => 16],
+ [['city'], 'string', 'max' => 128],
+ [['street', 'courier_full_name', 'courier_vehicle_description'], 'string', 'max' => 255],
+ [['order_id'], 'exist', 'skipOnError' => true, 'targetClass' => MarketplaceOrders::class, 'targetAttribute' => ['order_id' => 'id']],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'id' => 'ID записи',
+ 'order_id' => 'Ссылка на заказ',
+ 'type' => 'Тип доставки',
+ 'service_name' => 'Название службы доставки',
+ 'partner_type' => 'Тип партнера доставки',
+ 'country' => 'Страна',
+ 'postcode' => 'Индекс',
+ 'city' => 'Город',
+ 'street' => 'Улица',
+ 'house' => 'Дом',
+ 'apartment' => 'Квартира',
+ 'latitude' => 'Широта',
+ 'longitude' => 'Долгота',
+ 'delivery_start' => 'Начало периода доставки',
+ 'delivery_end' => 'Конец периода доставки',
+ 'courier_full_name' => 'ФИО курьера',
+ 'courier_phone' => 'Телефон курьера',
+ 'courier_extension' => 'Дополнительный номер курьера',
+ 'courier_vehicle_number' => 'Номер автомобиля курьера',
+ 'courier_vehicle_description' => 'Описание автомобиля курьера',
+ ];
+ }
+
+ /**
+ * Gets query for [[Order]].
+ *
+ * @return \yii\db\ActiveQuery
+ */
+ public function getOrder()
+ {
+ return $this->hasOne(MarketplaceOrders::class, ['id' => 'order_id']);
+ }
+
+}
--- /dev/null
+<?php
+
+namespace yii_app\records;
+
+use yii\base\Model;
+use yii\data\ActiveDataProvider;
+use yii_app\records\MarketplaceOrderDelivery;
+
+/**
+ * MarketplaceOrderDeliverySearch represents the model behind the search form of `yii_app\records\MarketplaceOrderDelivery`.
+ */
+class MarketplaceOrderDeliverySearch extends MarketplaceOrderDelivery
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function rules()
+ {
+ return [
+ [['id', 'order_id'], 'integer'],
+ [['type', 'service_name', 'partner_type', 'country', 'postcode', 'city', 'street', 'house', 'apartment', 'delivery_start', 'delivery_end', 'courier_full_name', 'courier_phone', 'courier_extension', 'courier_vehicle_number', 'courier_vehicle_description'], 'safe'],
+ [['latitude', 'longitude'], 'number'],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function scenarios()
+ {
+ // bypass scenarios() implementation in the parent class
+ return Model::scenarios();
+ }
+
+ /**
+ * Creates data provider instance with search query applied
+ *
+ * @param array $params
+ * @param string|null $formName Form name to be used into `->load()` method.
+ *
+ * @return ActiveDataProvider
+ */
+ public function search($params, $formName = null)
+ {
+ $query = MarketplaceOrderDelivery::find();
+
+ // add conditions that should always apply here
+
+ $dataProvider = new ActiveDataProvider([
+ 'query' => $query,
+ ]);
+
+ $this->load($params, $formName);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'id' => $this->id,
+ 'order_id' => $this->order_id,
+ 'latitude' => $this->latitude,
+ 'longitude' => $this->longitude,
+ 'delivery_start' => $this->delivery_start,
+ 'delivery_end' => $this->delivery_end,
+ ]);
+
+ $query->andFilterWhere(['ilike', 'type', $this->type])
+ ->andFilterWhere(['ilike', 'service_name', $this->service_name])
+ ->andFilterWhere(['ilike', 'partner_type', $this->partner_type])
+ ->andFilterWhere(['ilike', 'country', $this->country])
+ ->andFilterWhere(['ilike', 'postcode', $this->postcode])
+ ->andFilterWhere(['ilike', 'city', $this->city])
+ ->andFilterWhere(['ilike', 'street', $this->street])
+ ->andFilterWhere(['ilike', 'house', $this->house])
+ ->andFilterWhere(['ilike', 'apartment', $this->apartment])
+ ->andFilterWhere(['ilike', 'courier_full_name', $this->courier_full_name])
+ ->andFilterWhere(['ilike', 'courier_phone', $this->courier_phone])
+ ->andFilterWhere(['ilike', 'courier_extension', $this->courier_extension])
+ ->andFilterWhere(['ilike', 'courier_vehicle_number', $this->courier_vehicle_number])
+ ->andFilterWhere(['ilike', 'courier_vehicle_description', $this->courier_vehicle_description]);
+
+ return $dataProvider;
+ }
+}
--- /dev/null
+<?php
+
+namespace yii_app\records;
+
+use Yii;
+
+/**
+ * This is the model class for table "marketplace_order_status_history".
+ *
+ * @property int $id ID записи
+ * @property int $order_id Ссылка на заказ
+ * @property int $status_id Ссылка на тип статуса
+ * @property int $substatus_id Ссылка на подстатус
+ * @property int $active Активность записи
+ * @property string $date_from Дата и время начала активности
+ * @property string|null $date_end Дата и время окончания активности
+ * @property string|null $initiator Инициатор изменения
+ *
+ * @property MarketplaceOrders $order
+ * @property MarketplaceOrderStatusTypes $status
+ * @property MarketplaceOrderStatusTypes $substatus
+ */
+class MarketplaceOrderStatusHistory extends \yii\db\ActiveRecord
+{
+
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function tableName()
+ {
+ return 'marketplace_order_status_history';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function rules()
+ {
+ return [
+ [['date_end', 'initiator'], 'default', 'value' => null],
+ [['active'], 'default', 'value' => 1],
+ [['order_id', 'status_id', 'substatus_id', 'date_from'], 'required'],
+ [['order_id', 'status_id', 'substatus_id', 'active'], 'default', 'value' => null],
+ [['order_id', 'status_id', 'substatus_id', 'active'], 'integer'],
+ [['date_from', 'date_end'], 'safe'],
+ [['initiator'], 'string'],
+ [['status_id'], 'exist', 'skipOnError' => true, 'targetClass' => MarketplaceOrderStatusTypes::class, 'targetAttribute' => ['status_id' => 'id']],
+ [['substatus_id'], 'exist', 'skipOnError' => true, 'targetClass' => MarketplaceOrderStatusTypes::class, 'targetAttribute' => ['substatus_id' => 'id']],
+ [['order_id'], 'exist', 'skipOnError' => true, 'targetClass' => MarketplaceOrders::class, 'targetAttribute' => ['order_id' => 'id']],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'id' => 'ID записи',
+ 'order_id' => 'Ссылка на заказ',
+ 'status_id' => 'Ссылка на тип статуса',
+ 'substatus_id' => 'Ссылка на подстатус',
+ 'active' => 'Активность записи',
+ 'date_from' => 'Дата и время начала активности',
+ 'date_end' => 'Дата и время окончания активности',
+ 'initiator' => 'Инициатор изменения',
+ ];
+ }
+
+ /**
+ * Gets query for [[Order]].
+ *
+ * @return \yii\db\ActiveQuery
+ */
+ public function getOrder()
+ {
+ return $this->hasOne(MarketplaceOrders::class, ['id' => 'order_id']);
+ }
+
+ /**
+ * Gets query for [[Status]].
+ *
+ * @return \yii\db\ActiveQuery
+ */
+ public function getStatus()
+ {
+ return $this->hasOne(MarketplaceOrderStatusTypes::class, ['id' => 'status_id']);
+ }
+
+ /**
+ * Gets query for [[Substatus]].
+ *
+ * @return \yii\db\ActiveQuery
+ */
+ public function getSubstatus()
+ {
+ return $this->hasOne(MarketplaceOrderStatusTypes::class, ['id' => 'substatus_id']);
+ }
+
+}
--- /dev/null
+<?php
+
+namespace yii_app\records;
+
+use yii\base\Model;
+use yii\data\ActiveDataProvider;
+use yii_app\records\MarketplaceOrderStatusHistory;
+
+/**
+ * MarketplaceOrderStatusHistorySearch represents the model behind the search form of `yii_app\records\MarketplaceOrderStatusHistory`.
+ */
+class MarketplaceOrderStatusHistorySearch extends MarketplaceOrderStatusHistory
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function rules()
+ {
+ return [
+ [['id', 'order_id', 'status_id', 'substatus_id', 'active'], 'integer'],
+ [['date_from', 'date_end', 'initiator'], 'safe'],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function scenarios()
+ {
+ // bypass scenarios() implementation in the parent class
+ return Model::scenarios();
+ }
+
+ /**
+ * Creates data provider instance with search query applied
+ *
+ * @param array $params
+ * @param string|null $formName Form name to be used into `->load()` method.
+ *
+ * @return ActiveDataProvider
+ */
+ public function search($params, $formName = null)
+ {
+ $query = MarketplaceOrderStatusHistory::find();
+
+ // add conditions that should always apply here
+
+ $dataProvider = new ActiveDataProvider([
+ 'query' => $query,
+ ]);
+
+ $this->load($params, $formName);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'id' => $this->id,
+ 'order_id' => $this->order_id,
+ 'status_id' => $this->status_id,
+ 'substatus_id' => $this->substatus_id,
+ 'active' => $this->active,
+ 'date_from' => $this->date_from,
+ 'date_end' => $this->date_end,
+ ]);
+
+ $query->andFilterWhere(['ilike', 'initiator', $this->initiator]);
+
+ return $dataProvider;
+ }
+}
--- /dev/null
+<?php
+
+namespace yii_app\records;
+
+use Yii;
+
+/**
+ * This is the model class for table "marketplace_order_status_types".
+ *
+ * @property int $id ID статуса
+ * @property string $code Код статуса
+ * @property string|null $name Название статуса
+ * @property string|null $description Описание статуса
+ *
+ * @property MarketplaceOrderStatusHistory[] $marketplaceOrderStatusHistories
+ * @property MarketplaceOrderStatusHistory[] $marketplaceOrderStatusHistories0
+ */
+class MarketplaceOrderStatusTypes extends \yii\db\ActiveRecord
+{
+
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function tableName()
+ {
+ return 'marketplace_order_status_types';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function rules()
+ {
+ return [
+ [['name', 'description'], 'default', 'value' => null],
+ [['code'], 'required'],
+ [['code'], 'string', 'max' => 64],
+ [['name', 'description'], 'string', 'max' => 255],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'id' => 'ID статуса',
+ 'code' => 'Код статуса',
+ 'name' => 'Название статуса',
+ 'description' => 'Описание статуса',
+ ];
+ }
+
+ /**
+ * Gets query for [[MarketplaceOrderStatusHistories]].
+ *
+ * @return \yii\db\ActiveQuery
+ */
+ public function getMarketplaceOrderStatusHistories()
+ {
+ return $this->hasMany(MarketplaceOrderStatusHistory::class, ['status_id' => 'id']);
+ }
+
+ /**
+ * Gets query for [[MarketplaceOrderStatusHistories0]].
+ *
+ * @return \yii\db\ActiveQuery
+ */
+ public function getMarketplaceOrderStatusHistories0()
+ {
+ return $this->hasMany(MarketplaceOrderStatusHistory::class, ['substatus_id' => 'id']);
+ }
+
+}
--- /dev/null
+<?php
+
+namespace yii_app\records;
+
+use yii\base\Model;
+use yii\data\ActiveDataProvider;
+use yii_app\records\MarketplaceOrderStatusTypes;
+
+/**
+ * MarketplaceOrderStatusTypesSearch represents the model behind the search form of `yii_app\records\MarketplaceOrderStatusTypes`.
+ */
+class MarketplaceOrderStatusTypesSearch extends MarketplaceOrderStatusTypes
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function rules()
+ {
+ return [
+ [['id'], 'integer'],
+ [['code', 'name', 'description'], 'safe'],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function scenarios()
+ {
+ // bypass scenarios() implementation in the parent class
+ return Model::scenarios();
+ }
+
+ /**
+ * Creates data provider instance with search query applied
+ *
+ * @param array $params
+ * @param string|null $formName Form name to be used into `->load()` method.
+ *
+ * @return ActiveDataProvider
+ */
+ public function search($params, $formName = null)
+ {
+ $query = MarketplaceOrderStatusTypes::find();
+
+ // add conditions that should always apply here
+
+ $dataProvider = new ActiveDataProvider([
+ 'query' => $query,
+ ]);
+
+ $this->load($params, $formName);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'id' => $this->id,
+ ]);
+
+ $query->andFilterWhere(['ilike', 'code', $this->code])
+ ->andFilterWhere(['ilike', 'name', $this->name])
+ ->andFilterWhere(['ilike', 'description', $this->description]);
+
+ return $dataProvider;
+ }
+}
--- /dev/null
+<?php
+
+namespace yii_app\records;
+
+use Yii;
+
+/**
+ * This is the model class for table "marketplace_orders".
+ *
+ * @property int $id ID заказа
+ * @property string $marketplace_id ID заказа в системе маркетплейса
+ * @property string|null $store_id Идентификатор склада/магазина
+ * @property int|null $status_history_id Ссылка на текущий активный статус
+ * @property string $creation_date Дата создания заказа
+ * @property string $updated_at Время последнего обновления
+ * @property float $total Итоговая сумма к оплате
+ * @property float $delivery_total Стоимость доставки
+ * @property float $buyer_total_before_discount Сумма до скидок
+ * @property string $tax_system Система налогообложения
+ * @property string $payment_type Тип платежа
+ * @property string $payment_method Метод оплаты
+ * @property int $cancel_requested Флаг запроса отмены
+ * @property string|null $raw_data Полный сырой ответ API
+ * @property string|null $guid GUID заказа в 1С
+ * @property int|null $status_1c Статус заказа в 1С
+ *
+ * @property MarketplaceOrderDelivery[] $marketplaceOrderDeliveries
+ * @property MarketplaceOrderStatusHistory[] $marketplaceOrderStatusHistories
+ */
+class MarketplaceOrders extends \yii\db\ActiveRecord
+{
+
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function tableName()
+ {
+ return 'marketplace_orders';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function rules()
+ {
+ return [
+ [['store_id', 'status_history_id', 'raw_data', 'guid'], 'default', 'value' => null],
+ [['cancel_requested'], 'default', 'value' => 0],
+ [['status_1c'], 'default', 'value' => 1],
+ [['marketplace_id', 'creation_date', 'updated_at', 'total', 'delivery_total', 'buyer_total_before_discount', 'tax_system', 'payment_type', 'payment_method'], 'required'],
+ [['status_history_id', 'cancel_requested', 'status_1c'], 'default', 'value' => null],
+ [['status_history_id', 'cancel_requested', 'status_1c'], 'integer'],
+ [['creation_date', 'updated_at'], 'safe'],
+ [['total', 'delivery_total', 'buyer_total_before_discount'], 'number'],
+ [['raw_data'], 'string'],
+ [['marketplace_id'], 'string', 'max' => 64],
+ [['store_id', 'guid'], 'string', 'max' => 36],
+ [['tax_system', 'payment_type', 'payment_method'], 'string', 'max' => 32],
+ [['marketplace_id'], 'unique'],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'id' => 'ID заказа',
+ 'marketplace_id' => 'ID заказа в системе маркетплейса',
+ 'store_id' => 'Идентификатор склада/магазина',
+ 'status_history_id' => 'Ссылка на текущий активный статус',
+ 'creation_date' => 'Дата создания заказа',
+ 'updated_at' => 'Время последнего обновления',
+ 'total' => 'Итоговая сумма к оплате',
+ 'delivery_total' => 'Стоимость доставки',
+ 'buyer_total_before_discount' => 'Сумма до скидок',
+ 'tax_system' => 'Система налогообложения',
+ 'payment_type' => 'Тип платежа',
+ 'payment_method' => 'Метод оплаты',
+ 'cancel_requested' => 'Флаг запроса отмены',
+ 'raw_data' => 'Полный сырой ответ API',
+ 'guid' => 'GUID заказа в 1С',
+ 'status_1c' => 'Статус заказа в 1С',
+ ];
+ }
+
+ /**
+ * Gets query for [[MarketplaceOrderDeliveries]].
+ *
+ * @return \yii\db\ActiveQuery
+ */
+ public function getMarketplaceOrderDeliveries()
+ {
+ return $this->hasMany(MarketplaceOrderDelivery::class, ['order_id' => 'id']);
+ }
+
+ /**
+ * Gets query for [[MarketplaceOrderStatusHistories]].
+ *
+ * @return \yii\db\ActiveQuery
+ */
+ public function getMarketplaceOrderStatusHistories()
+ {
+ return $this->hasMany(MarketplaceOrderStatusHistory::class, ['order_id' => 'id']);
+ }
+
+}
--- /dev/null
+<?php
+
+namespace yii_app\records;
+
+use yii\base\Model;
+use yii\data\ActiveDataProvider;
+use yii_app\records\MarketplaceOrders;
+
+/**
+ * MarketplaceOrdersSearch represents the model behind the search form of `yii_app\records\MarketplaceOrders`.
+ */
+class MarketplaceOrdersSearch extends MarketplaceOrders
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function rules()
+ {
+ return [
+ [['id', 'status_history_id', 'cancel_requested', 'status_1c'], 'integer'],
+ [['marketplace_id', 'store_id', 'creation_date', 'updated_at', 'tax_system', 'payment_type', 'payment_method', 'raw_data', 'guid'], 'safe'],
+ [['total', 'delivery_total', 'buyer_total_before_discount'], 'number'],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function scenarios()
+ {
+ // bypass scenarios() implementation in the parent class
+ return Model::scenarios();
+ }
+
+ /**
+ * Creates data provider instance with search query applied
+ *
+ * @param array $params
+ * @param string|null $formName Form name to be used into `->load()` method.
+ *
+ * @return ActiveDataProvider
+ */
+ public function search($params, $formName = null)
+ {
+ $query = MarketplaceOrders::find();
+
+ // add conditions that should always apply here
+
+ $dataProvider = new ActiveDataProvider([
+ 'query' => $query,
+ ]);
+
+ $this->load($params, $formName);
+
+ if (!$this->validate()) {
+ // uncomment the following line if you do not want to return any records when validation fails
+ // $query->where('0=1');
+ return $dataProvider;
+ }
+
+ // grid filtering conditions
+ $query->andFilterWhere([
+ 'id' => $this->id,
+ 'status_history_id' => $this->status_history_id,
+ 'creation_date' => $this->creation_date,
+ 'updated_at' => $this->updated_at,
+ 'total' => $this->total,
+ 'delivery_total' => $this->delivery_total,
+ 'buyer_total_before_discount' => $this->buyer_total_before_discount,
+ 'cancel_requested' => $this->cancel_requested,
+ 'status_1c' => $this->status_1c,
+ ]);
+
+ $query->andFilterWhere(['ilike', 'marketplace_id', $this->marketplace_id])
+ ->andFilterWhere(['ilike', 'store_id', $this->store_id])
+ ->andFilterWhere(['ilike', 'tax_system', $this->tax_system])
+ ->andFilterWhere(['ilike', 'payment_type', $this->payment_type])
+ ->andFilterWhere(['ilike', 'payment_method', $this->payment_method])
+ ->andFilterWhere(['ilike', 'raw_data', $this->raw_data])
+ ->andFilterWhere(['ilike', 'guid', $this->guid]);
+
+ return $dataProvider;
+ }
+}
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrderDeliverySearch $model */
+/** @var yii\widgets\ActiveForm $form */
+?>
+
+<div class="marketplace-order-delivery-search">
+
+ <?php $form = ActiveForm::begin([
+ 'action' => ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ <?= $form->field($model, 'id') ?>
+
+ <?= $form->field($model, 'order_id') ?>
+
+ <?= $form->field($model, 'type') ?>
+
+ <?= $form->field($model, 'service_name') ?>
+
+ <?= $form->field($model, 'partner_type') ?>
+
+ <?php // echo $form->field($model, 'country') ?>
+
+ <?php // echo $form->field($model, 'postcode') ?>
+
+ <?php // echo $form->field($model, 'city') ?>
+
+ <?php // echo $form->field($model, 'street') ?>
+
+ <?php // echo $form->field($model, 'house') ?>
+
+ <?php // echo $form->field($model, 'apartment') ?>
+
+ <?php // echo $form->field($model, 'latitude') ?>
+
+ <?php // echo $form->field($model, 'longitude') ?>
+
+ <?php // echo $form->field($model, 'delivery_start') ?>
+
+ <?php // echo $form->field($model, 'delivery_end') ?>
+
+ <?php // echo $form->field($model, 'courier_full_name') ?>
+
+ <?php // echo $form->field($model, 'courier_phone') ?>
+
+ <?php // echo $form->field($model, 'courier_extension') ?>
+
+ <?php // echo $form->field($model, 'courier_vehicle_number') ?>
+
+ <?php // echo $form->field($model, 'courier_vehicle_description') ?>
+
+ <div class="form-group">
+ <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
+ <?= Html::resetButton('Reset', ['class' => 'btn btn-outline-secondary']) ?>
+ </div>
+
+ <?php ActiveForm::end(); ?>
+
+</div>
--- /dev/null
+<?php
+
+use yii_app\records\MarketplaceOrderDelivery;
+use yii\helpers\Html;
+use yii\helpers\Url;
+use yii\grid\ActionColumn;
+use yii\grid\GridView;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrderDeliverySearch $searchModel */
+/** @var yii\data\ActiveDataProvider $dataProvider */
+
+$this->title = 'Marketplace Order Deliveries';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="marketplace-order-delivery-index">
+
+ <h1><?= Html::encode($this->title) ?></h1>
+
+ <p>
+ <?= Html::a('Create Marketplace Order Delivery', ['create'], ['class' => 'btn btn-success']) ?>
+ </p>
+
+ <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
+
+ <?= GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'id',
+ 'order_id',
+ 'type',
+ 'service_name',
+ 'partner_type',
+ //'country',
+ //'postcode',
+ //'city',
+ //'street',
+ //'house',
+ //'apartment',
+ //'latitude',
+ //'longitude',
+ //'delivery_start',
+ //'delivery_end',
+ //'courier_full_name',
+ //'courier_phone',
+ //'courier_extension',
+ //'courier_vehicle_number',
+ //'courier_vehicle_description',
+ [
+ 'class' => ActionColumn::className(),
+ 'urlCreator' => function ($action, MarketplaceOrderDelivery $model, $key, $index, $column) {
+ return Url::toRoute([$action, 'id' => $model->id]);
+ }
+ ],
+ ],
+ ]); ?>
+
+
+</div>
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\DetailView;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrderDelivery $model */
+
+$this->title = $model->id;
+$this->params['breadcrumbs'][] = ['label' => 'Marketplace Order Deliveries', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+\yii\web\YiiAsset::register($this);
+?>
+<div class="marketplace-order-delivery-view">
+
+ <h1><?= Html::encode($this->title) ?></h1>
+
+ <p>
+ <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
+ <?= Html::a('Delete', ['delete', 'id' => $model->id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => 'Are you sure you want to delete this item?',
+ 'method' => 'post',
+ ],
+ ]) ?>
+ </p>
+
+ <?= DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'id',
+ 'order_id',
+ 'type',
+ 'service_name',
+ 'partner_type',
+ 'country',
+ 'postcode',
+ 'city',
+ 'street',
+ 'house',
+ 'apartment',
+ 'latitude',
+ 'longitude',
+ 'delivery_start',
+ 'delivery_end',
+ 'courier_full_name',
+ 'courier_phone',
+ 'courier_extension',
+ 'courier_vehicle_number',
+ 'courier_vehicle_description',
+ ],
+ ]) ?>
+
+</div>
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrderStatusHistorySearch $model */
+/** @var yii\widgets\ActiveForm $form */
+?>
+
+<div class="marketplace-order-status-history-search">
+
+ <?php $form = ActiveForm::begin([
+ 'action' => ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ <?= $form->field($model, 'id') ?>
+
+ <?= $form->field($model, 'order_id') ?>
+
+ <?= $form->field($model, 'status_id') ?>
+
+ <?= $form->field($model, 'substatus_id') ?>
+
+ <?= $form->field($model, 'active') ?>
+
+ <?php // echo $form->field($model, 'date_from') ?>
+
+ <?php // echo $form->field($model, 'date_end') ?>
+
+ <?php // echo $form->field($model, 'initiator') ?>
+
+ <div class="form-group">
+ <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
+ <?= Html::resetButton('Reset', ['class' => 'btn btn-outline-secondary']) ?>
+ </div>
+
+ <?php ActiveForm::end(); ?>
+
+</div>
--- /dev/null
+<?php
+
+use yii_app\records\MarketplaceOrderStatusHistory;
+use yii\helpers\Html;
+use yii\helpers\Url;
+use yii\grid\ActionColumn;
+use yii\grid\GridView;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrderStatusHistorySearch $searchModel */
+/** @var yii\data\ActiveDataProvider $dataProvider */
+
+$this->title = 'Marketplace Order Status Histories';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="marketplace-order-status-history-index">
+
+ <h1><?= Html::encode($this->title) ?></h1>
+
+ <p>
+ <?= Html::a('Create Marketplace Order Status History', ['create'], ['class' => 'btn btn-success']) ?>
+ </p>
+
+ <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
+
+ <?= GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'id',
+ 'order_id',
+ 'status_id',
+ 'substatus_id',
+ 'active',
+ //'date_from',
+ //'date_end',
+ //'initiator:ntext',
+ [
+ 'class' => ActionColumn::className(),
+ 'urlCreator' => function ($action, MarketplaceOrderStatusHistory $model, $key, $index, $column) {
+ return Url::toRoute([$action, 'id' => $model->id]);
+ }
+ ],
+ ],
+ ]); ?>
+
+
+</div>
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\DetailView;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrderStatusHistory $model */
+
+$this->title = $model->id;
+$this->params['breadcrumbs'][] = ['label' => 'Marketplace Order Status Histories', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+\yii\web\YiiAsset::register($this);
+?>
+<div class="marketplace-order-status-history-view">
+
+ <h1><?= Html::encode($this->title) ?></h1>
+
+ <p>
+ <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
+ <?= Html::a('Delete', ['delete', 'id' => $model->id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => 'Are you sure you want to delete this item?',
+ 'method' => 'post',
+ ],
+ ]) ?>
+ </p>
+
+ <?= DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'id',
+ 'order_id',
+ 'status_id',
+ 'substatus_id',
+ 'active',
+ 'date_from',
+ 'date_end',
+ 'initiator:ntext',
+ ],
+ ]) ?>
+
+</div>
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrderStatusTypes $model */
+/** @var yii\widgets\ActiveForm $form */
+?>
+
+<div class="marketplace-order-status-types-form p-4">
+
+ <?php $form = ActiveForm::begin(); ?>
+
+ <?= $form->field($model, 'code')->textInput(['maxlength' => true]) ?>
+
+ <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
+
+ <?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?>
+
+ <div class="form-group">
+ <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
+ </div>
+
+ <?php ActiveForm::end(); ?>
+
+</div>
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrderStatusTypesSearch $model */
+/** @var yii\widgets\ActiveForm $form */
+?>
+
+<div class="marketplace-order-status-types-search">
+
+ <?php $form = ActiveForm::begin([
+ 'action' => ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ <?= $form->field($model, 'id') ?>
+
+ <?= $form->field($model, 'code') ?>
+
+ <?= $form->field($model, 'name') ?>
+
+ <?= $form->field($model, 'description') ?>
+
+ <div class="form-group">
+ <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
+ <?= Html::resetButton('Reset', ['class' => 'btn btn-outline-secondary']) ?>
+ </div>
+
+ <?php ActiveForm::end(); ?>
+
+</div>
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrderStatusTypes $model */
+
+$this->title = 'Создание статуса заказа';
+$this->params['breadcrumbs'][] = ['label' => 'Marketplace Order Status Types', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="marketplace-order-status-types-create p-4">
+ <?= Html::a('Назад', ['index'], ['class' => 'btn btn-primary m-5']) ?>
+ <h1><?= Html::encode($this->title) ?></h1>
+
+ <?= $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+</div>
--- /dev/null
+<?php
+
+use yii_app\records\MarketplaceOrderStatusTypes;
+use yii\helpers\Html;
+use yii\helpers\Url;
+use yii\grid\ActionColumn;
+use yii\grid\GridView;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrderStatusTypesSearch $searchModel */
+/** @var yii\data\ActiveDataProvider $dataProvider */
+
+$this->title = 'Статусы заказов Яндекс Маркет';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="marketplace-order-status-types-index p-4">
+
+ <h1><?= Html::encode($this->title) ?></h1>
+
+ <p>
+ <?= Html::a('Добавить статус', ['create'], ['class' => 'btn btn-success']) ?>
+ </p>
+
+ <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
+
+ <?= GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'id',
+ 'code',
+ 'name',
+ 'description',
+ [
+ 'class' => ActionColumn::class,
+ 'urlCreator' => function ($action, MarketplaceOrderStatusTypes $model, $key, $index, $column) {
+ return Url::toRoute([$action, 'id' => $model->id]);
+ }
+ ],
+ ],
+ ]); ?>
+
+
+</div>
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrderStatusTypes $model */
+
+$this->title = 'Изменение статуса заказа: ' . $model->name;
+$this->params['breadcrumbs'][] = ['label' => 'Marketplace Order Status Types', 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
+$this->params['breadcrumbs'][] = 'Update';
+?>
+<div class="marketplace-order-status-types-update p-4">
+ <?= Html::a('Назад', ['index'], ['class' => 'btn btn-primary m-5']) ?>
+ <h1><?= Html::encode($this->title) ?></h1>
+
+ <?= $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+</div>
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\DetailView;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrderStatusTypes $model */
+
+$this->title = 'Статусы заказа' . $model->name;
+$this->params['breadcrumbs'][] = ['label' => 'Marketplace Order Status Types', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+\yii\web\YiiAsset::register($this);
+?>
+<div class="marketplace-order-status-types-view p-4">
+ <?= Html::a('Назад', ['index'], ['class' => 'btn btn-primary m-5']) ?>
+ <h1><?= Html::encode($this->title) ?></h1>
+
+ <p>
+ <?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
+ <?= Html::a('Удалить', ['delete', 'id' => $model->id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => 'Удалить статус?',
+ 'method' => 'post',
+ ],
+ ]) ?>
+ </p>
+
+ <?= DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'id',
+ 'code',
+ 'name',
+ 'description',
+ ],
+ ]) ?>
+
+</div>
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrdersSearch $model */
+/** @var yii\widgets\ActiveForm $form */
+?>
+
+<div class="marketplace-orders-search">
+
+ <?php $form = ActiveForm::begin([
+ 'action' => ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ <?= $form->field($model, 'id') ?>
+
+ <?= $form->field($model, 'marketplace_id') ?>
+
+ <?= $form->field($model, 'store_id') ?>
+
+ <?= $form->field($model, 'status_history_id') ?>
+
+ <?= $form->field($model, 'creation_date') ?>
+
+ <?php // echo $form->field($model, 'updated_at') ?>
+
+ <?php // echo $form->field($model, 'total') ?>
+
+ <?php // echo $form->field($model, 'delivery_total') ?>
+
+ <?php // echo $form->field($model, 'buyer_total_before_discount') ?>
+
+ <?php // echo $form->field($model, 'tax_system') ?>
+
+ <?php // echo $form->field($model, 'payment_type') ?>
+
+ <?php // echo $form->field($model, 'payment_method') ?>
+
+ <?php // echo $form->field($model, 'cancel_requested') ?>
+
+ <?php // echo $form->field($model, 'raw_data') ?>
+
+ <?php // echo $form->field($model, 'guid') ?>
+
+ <?php // echo $form->field($model, 'status_1c') ?>
+
+ <div class="form-group">
+ <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
+ <?= Html::resetButton('Reset', ['class' => 'btn btn-outline-secondary']) ?>
+ </div>
+
+ <?php ActiveForm::end(); ?>
+
+</div>
--- /dev/null
+<?php
+
+use yii_app\records\MarketplaceOrders;
+use yii\helpers\Html;
+use yii\helpers\Url;
+use yii\grid\ActionColumn;
+use yii\grid\GridView;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrdersSearch $searchModel */
+/** @var yii\data\ActiveDataProvider $dataProvider */
+
+$this->title = 'Marketplace Orders';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="marketplace-orders-index">
+
+ <h1><?= Html::encode($this->title) ?></h1>
+
+ <p>
+ <?= Html::a('Create Marketplace Orders', ['create'], ['class' => 'btn btn-success']) ?>
+ </p>
+
+ <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
+
+ <?= GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'id',
+ 'marketplace_id',
+ 'store_id',
+ 'status_history_id',
+ 'creation_date',
+ //'updated_at',
+ //'total',
+ //'delivery_total',
+ //'buyer_total_before_discount',
+ //'tax_system',
+ //'payment_type',
+ //'payment_method',
+ //'cancel_requested',
+ //'raw_data:ntext',
+ //'guid',
+ //'status_1c',
+ [
+ 'class' => ActionColumn::className(),
+ 'urlCreator' => function ($action, MarketplaceOrders $model, $key, $index, $column) {
+ return Url::toRoute([$action, 'id' => $model->id]);
+ }
+ ],
+ ],
+ ]); ?>
+
+
+</div>
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\DetailView;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrders $model */
+
+$this->title = $model->id;
+$this->params['breadcrumbs'][] = ['label' => 'Marketplace Orders', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+\yii\web\YiiAsset::register($this);
+?>
+<div class="marketplace-orders-view">
+
+ <h1><?= Html::encode($this->title) ?></h1>
+
+ <p>
+ <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
+ <?= Html::a('Delete', ['delete', 'id' => $model->id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => 'Are you sure you want to delete this item?',
+ 'method' => 'post',
+ ],
+ ]) ?>
+ </p>
+
+ <?= DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'id',
+ 'marketplace_id',
+ 'store_id',
+ 'status_history_id',
+ 'creation_date',
+ 'updated_at',
+ 'total',
+ 'delivery_total',
+ 'buyer_total_before_discount',
+ 'tax_system',
+ 'payment_type',
+ 'payment_method',
+ 'cancel_requested',
+ 'raw_data:ntext',
+ 'guid',
+ 'status_1c',
+ ],
+ ]) ?>
+
+</div>