From: marina Date: Wed, 23 Oct 2024 13:55:50 +0000 (+0300) Subject: ERP-150 Присвоить каждому магазину ID склада откат X-Git-Tag: 1.6~28 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=fcc89c5e230c7fa484cc178d2d43136fe79728d8;p=erp24_rep%2Fyii-erp24%2F.git ERP-150 Присвоить каждому магазину ID склада откат --- diff --git a/erp24/controllers/MarketplaceStoreController.php b/erp24/controllers/MarketplaceStoreController.php deleted file mode 100755 index a5be886c..00000000 --- a/erp24/controllers/MarketplaceStoreController.php +++ /dev/null @@ -1,95 +0,0 @@ - MarketplaceStore::find(), - 'pagination' => false, - ]); - - return $this->render('index', [ - 'dataProvider' => $dataProvider, - 'firms' => $firms - ]); - } - - public function actionView($id) - { - $model = $this->findModel($id); - $firms = Firms::getInn(); - - return $this->render('view', [ - 'model' => $model, - 'firms' => $firms, - ]); - } - - public function actionCreate() - { - $model = new MarketplaceStore(); - $stores = CityStore::getAllActiveIdName(); - $firms = Firms::getInn(); - $storesGuid = CityStore::getAllActiveGuidId(); - - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->id]); - } - - return $this->render('create', [ - 'model' => $model, - 'stores' => $stores, - 'storesGuid' => $storesGuid, - 'firms' => $firms, - ]); - } - - public function actionUpdate($id) - { - $model = MarketplaceStore::findOne($id); - $stores = CityStore::getAllActiveIdName(); - $firms = Firms::getInn(); - $storesGuid = CityStore::getAllActiveGuidId(); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->id]); - } - - return $this->render('update', [ - 'model' => $model, - 'stores' => $stores, - 'storesGuid' => $storesGuid, - 'firms' => $firms, - ]); - } - - public function actionDelete($id) - { - $this->findModel($id)->delete(); - - return $this->redirect(['index']); - } - - protected function findModel($id) - { - if (($model = MarketplaceStore::findOne($id)) !== null) { - return $model; - } - - throw new NotFoundHttpException('The requested page does not exist.'); - } -} diff --git a/erp24/migrations/m241023_064710_create_marketplace_store_table.php b/erp24/migrations/m241023_064710_create_marketplace_store_table.php deleted file mode 100644 index bf3cae0e..00000000 --- a/erp24/migrations/m241023_064710_create_marketplace_store_table.php +++ /dev/null @@ -1,44 +0,0 @@ -db->schema->getTableSchema('erp24.marketplace_store', true)) { - $this->createTable('{{%erp24.marketplace_store}}', [ - 'id' => $this->primaryKey(), - 'store_id' => $this->integer()->notNull()->comment('id магазина'), - 'guid' => $this->string(255)->notNull()->comment('гуид магазина'), - 'name' => $this->string()->comment('название магазина(адрес) = название склада'), - 'yandex_market_id' => $this->integer()->comment('id склада в данном маркетплейсе'), - 'flowwow_id' => $this->integer()->comment('id склада в данном маркетплейсе'), - 'firm' => $this->string(255)->comment('юр . лицо, к которому относится магазин'), - 'created_at' => $this->datetime()->notNull()->comment('дата создания записи'), - 'created_by' => $this->integer()->notNull()->comment('автор создания записи'), - 'updated_at' => $this->datetime()->notNull()->comment('дата изменения записи'), - 'updated_by' => $this->integer()->notNull()->comment('автор изменения записи'), - ]); - - $this->addForeignKey('fk_marketplace_store_to_city_store', '{{%erp24.marketplace_store}}', 'store_id', '{{%city_store}}', 'id'); - } - } - - /** - * {@inheritdoc} - */ - public function safeDown() - { - if ($this->db->schema->getTableSchema('erp24.marketplace_store', true)) { - $this->dropForeignKey('fk_marketplace_store_to_city_store', '{{%erp24.marketplace_store}}'); - $this->dropTable('{{%erp24.marketplace_store}}'); - } - } -} diff --git a/erp24/records/CityStore.php b/erp24/records/CityStore.php index 36e1d3f8..34bdb099 100755 --- a/erp24/records/CityStore.php +++ b/erp24/records/CityStore.php @@ -265,22 +265,6 @@ class CityStore extends ActiveRecord return $result; } - - public static function getAllActiveGuidId() - { - $result = []; - - $values = self::find()->joinWith('storeGuid') - ->orderBy([self::tableName() . '.id' => SORT_ASC])->asArray() - ->all(); - - if (!empty($values)) { - $result = ArrayHelper::map($values, 'id', 'storeGuid.export_val'); - } - - return $result; - } - public static function getCityStoreById(int $id, $withGuid = false): array { $query = self::find(); diff --git a/erp24/records/MarketplaceStore.php b/erp24/records/MarketplaceStore.php deleted file mode 100755 index 7c30aa6a..00000000 --- a/erp24/records/MarketplaceStore.php +++ /dev/null @@ -1,96 +0,0 @@ - CityStore::class, 'targetAttribute' => 'id'], - [['name', 'guid', 'firm'], 'string'], - [['store_id', 'yandex_market_id', 'flowwow_id', 'created_at', 'created_by', 'updated_at', 'updated_by'], 'integer'], - - ]; - } - - public function behaviors() - { - return [ - [ - 'class' => TimestampBehavior::class, - 'createdAtAttribute' => 'created_at', - 'updatedAtAttribute' => 'updated_at', - 'value' => new Expression('NOW()'), - ], - [ - 'class' => BlameableBehavior::class, - 'createdByAttribute' => 'created_by', - 'updatedByAttribute' => 'updated_by', - ], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'ID', - 'store_id' => 'ID магазина', - 'guid' => 'GUID магазина', - 'name' => 'Название магазина(адрес) = Название склада', - 'yandex_market_id' => 'ID склада в Яндекс Маркете', - 'flowwow_id' => 'ID склада в Flowwow', - 'firm' => 'Юр.лицо, к которому относится магазин', - 'created_at' => 'Дата создания записи', - 'created_by' => 'Автор создания записи', - 'updated_at' => 'Дата изменения записи', - 'updated_by' => 'Автор изменения записи' - ]; - } - - public function getStore() { - return $this->hasOne(CityStore::class, ['id' => 'store_id']); - } - - public function getCreatedBy() { - return $this->hasOne(Admin::class, ['id' => 'created_by']); - } - - public function getUpdatedBy() { - return $this->hasOne(Admin::class, ['id' => 'updated_by']); - } -} diff --git a/erp24/views/marketplace-store/_form.php b/erp24/views/marketplace-store/_form.php deleted file mode 100644 index 7331b3f4..00000000 --- a/erp24/views/marketplace-store/_form.php +++ /dev/null @@ -1,39 +0,0 @@ - - -
- - - field($model, 'store_id')->dropDownList($stores, [ - 'prompt' => 'Выберите магазин', - 'onchange' => 'updateGuid(this.value)' // Вызов функции для обновления guid - ]) ?> - - field($model, 'guid')->textInput(['maxlength' => true, 'value' => $model->guid, 'readonly' => true, 'id' => 'guid-input']) ?> - field($model, 'yandex_market_id')->textInput() ?> - field($model, 'flowwow_id')->textInput(['type' => 'integer']) ?> - field($model, 'firm')->dropDownList($firms, ['prompt' => 'Выберите юр лицо']) ?> - -
- isNewRecord ? 'Создать' : 'Сохранить', ['class' => 'btn btn-success']) ?> -
- - - -
- - - \ No newline at end of file diff --git a/erp24/views/marketplace-store/create.php b/erp24/views/marketplace-store/create.php deleted file mode 100644 index c7031bae..00000000 --- a/erp24/views/marketplace-store/create.php +++ /dev/null @@ -1,21 +0,0 @@ -title = 'Создать Магазин'; -$this->params['breadcrumbs'][] = ['label' => 'Список Магазинов', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -?> - -
- -

title) ?>

- - render('_form', [ - 'model' => $model, - 'stores' => $stores, - 'storesGuid' => $storesGuid, - 'firms' => $firms, - ]) ?> - -
diff --git a/erp24/views/marketplace-store/index.php b/erp24/views/marketplace-store/index.php deleted file mode 100644 index 43c01573..00000000 --- a/erp24/views/marketplace-store/index.php +++ /dev/null @@ -1,46 +0,0 @@ -title = 'Список Магазинов'; -$this->params['breadcrumbs'][] = $this->title; -?> -
- -

title) ?>

- -

- 'btn btn-success']) ?> -

- - $dataProvider, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], - - 'id', - [ - 'attribute' => 'store_id', - 'value' => function ($model) { - return $model->store->name; - } - ], - 'guid', - 'yandex_market_id', - 'flowwow_id', - [ - 'attribute' => 'firm', - 'value' => function ($model) { - return Firms::getInn()[$model->firm]; - } - ], - 'created_at', - 'updated_at', - - ['class' => 'yii\grid\ActionColumn'], - ], - ]); ?> - -
diff --git a/erp24/views/marketplace-store/update.php b/erp24/views/marketplace-store/update.php deleted file mode 100644 index f5e9bca5..00000000 --- a/erp24/views/marketplace-store/update.php +++ /dev/null @@ -1,21 +0,0 @@ -title = 'Обновить Магазин: ' . $model->store->name; -$this->params['breadcrumbs'][] = ['label' => 'Список Магазинов', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -?> - -
- -

title) ?>

- - render('_form', [ - 'model' => $model, - 'stores' => $stores, - 'storesGuid' => $storesGuid, - 'firms' => $firms, - ]) ?> - -
diff --git a/erp24/views/marketplace-store/view.php b/erp24/views/marketplace-store/view.php deleted file mode 100644 index 7c988264..00000000 --- a/erp24/views/marketplace-store/view.php +++ /dev/null @@ -1,68 +0,0 @@ -title = 'Просмотр магазина: ' . $model->store->name; -$this->params['breadcrumbs'][] = ['label' => 'Список Магазинов', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -?> - -
- -

title) ?>

- -

- $model->id], ['class' => 'btn btn-primary']) ?> - $model->id], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => 'Вы уверены, что хотите удалить этот элемент?', - 'method' => 'post', - ], - ]) ?> -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IDid) ?>
ID Магазинаstore->name) ?>
GUIDguid) ?>
ID в Яндекс.Маркетеyandex_market_id) ?>
ID в Flowwowflowwow_id) ?>
Юридическое Лицоfirm]) ?>
Автор созданияcreatedBy->name) ?>
Дата созданияcreated_at))) ?>
Автор обновленияupdatedBy->name) ?>
Дата обновленияupdated_at))) ?>
- -