use Exception;
use Yii;
use yii\db\Expression;
+use yii\helpers\ArrayHelper;
use yii\helpers\Url;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
CityStore,
Files,
MatrixType,
+ Products1cNomenclature,
StoreType,
WriteOffsErp};
'marketplace' => $marketplaceList,
];
}
+
+ public function actionGetList()
+ {
+ Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
+
+ $query = Products1cNomenclature::find()
+ ->andFilterWhere(['size' => Yii::$app->request->post('size')])
+ ->andFilterWhere(['type' => Yii::$app->request->post('type')])
+ ->andFilterWhere(['species' => Yii::$app->request->post('species')])
+ ->andFilterWhere(['color' => Yii::$app->request->post('color')])
+ ->andFilterWhere(['category' => Yii::$app->request->post('category')]);
+
+ return ArrayHelper::map($query->all(), 'id', 'name');
+ }
+
public function actionConfirm(int $id): \yii\web\Response
{
$model = BouquetComposition::findOne($id) ?? throw new NotFoundHttpException('Букет не найден');
* @property string|null $date_confirm
* @property string|null $date_1c_send
* @property string|null $confirm_admin
+ * @property string|null $error_text
*
* @property BouquetCompositionProducts[] $bouquetCompositionProducts
* @property BouquetCompositionMatrixTypeHistory $matrixType
[['created_by', 'updated_by', 'status', 'date_1c_send', 'date_confirm'], 'integer', 'message' => '{attribute} должен быть целым числом'],
[['created_at', 'updated_at', 'admin_confirm'], 'safe'],
[['guid', 'name'], 'string', 'max' => 255, 'tooLong' => '{attribute} не должен превышать 255 символов'],
+ [['error_text'], 'string'],
[['photo_bouquet'], 'file',
'extensions' => 'jpg, jpeg, png, gif',
'maxFiles' => 10,
'confirm_admin' => 'ID подтвердившего',
'updated_by' => 'ID обновителя записи',
'status' => 'Статус',
-
+ 'error_text' => 'Ошибка',
];
}
*/
public static function getAvailableItems(bool $isNewRecord, ?int $bouquetId = null): array
{
- $query = Products1c::find()
- ->where(['view' => Products1c::IS_VISIBLE, 'tip' => Products1c::TYPE_PRODUCTS]);
+ $query = Products1cNomenclature::find();
if (!$isNewRecord && $bouquetId) {
$selectedIds = self::find()
'showQuantity' => true,
'listContainerSize' => $listContainerSize,
'triggerButton' => 'apply-button',
- 'filterFields' => ['size', 'color', 'species', 'category', 'type-num']
+ 'filterFields' => ['size', 'color', 'species', 'category', 'type']
]) ?>
<br>
'class' => 'btn btn-success btn-edit w-100 mt-4'
]) ?>
</div>
-<?php }?>
\ No newline at end of file
+<?php }?>
+<?php if ($model && !empty($model->error_text)): ?>
+ <div class="row">
+ <span class="badge bg-danger fs-6 ms-3 text-white w-95 mb-4 d-block" style="word-wrap: break-word; white-space: normal;">
+ <?= Html::encode($model->error_text) ?>
+ </span>
+ </div>
+<?php endif; ?>
use yii_app\records\Files;
use yii_app\records\MatrixType;
use yii_app\records\Products1c;
+use yii_app\records\WriteOffsErp;
/** @var yii\web\View $this */
$this->title = 'Содержание матрицы';
</div>
<div class="col-md-2">
- <div class="form-group mb-0">
- <?= Html::dropDownList("year", Yii::$app->request->get('year'), BouquetComposition::getYears(), [
- 'class' => 'form-control',
- 'prompt' => 'Год'
- ]) ?>
- </div>
</div>
<div class="col-md-2">
- <div class="form-group mb-0">
- <?= Html::dropDownList("month", Yii::$app->request->get('month'), \yii_app\helpers\DateHelper::MONTH_NUMBER_NAMES, [
- 'class' => 'form-control',
- 'prompt' => 'Месяц'
- ]) ?>
- </div>
</div>
<div class="col-md-2 mt-5">
['style' => 'width: 100%; height: 100%; object-fit: cover;']) . "
</div>
</div>
-
+ <div class='col-md-3 pt-1 text-center'>
+ <div class='row'>
+ " . (!empty($model->status) ? "
+ <label class='h5 fw-bold mb-1'>Статус букета</label>
+ <span class='badge " .
+ match ($model->status) {
+ WriteOffsErp::STATUS_CREATED => 'bg-info',
+ WriteOffsErp::STATUS_CONFIRM,
+ WriteOffsErp::STATUS_CREATED_1С => 'bg-success',
+ WriteOffsErp::STATUS_SEND => 'bg-warning',
+ WriteOffsErp::STATUS_DISABLE,
+ WriteOffsErp::STATUS_ERROR_1С => 'bg-danger',
+ default => 'bg-secondary',
+ } .
+ " fs-6 text-white px-7 w-100 mb-4 d-block'>
+ " . Html::encode(\yii_app\records\WriteOffsErp::STATUSES[$model->status] ?? '') . "
+ </span>
+ " : "") . "
+ </div>
+ " . (!empty($model->error_text) ? "
+ <div class='row'>
+ <label class='h5 fw-bold mb-1'>Ошибка</label>
+ <span class='badge bg-danger fs-6 text-white w-100 mb-4 d-block' style='word-wrap: break-word; white-space: normal;'>
+ " . Html::encode($model->error_text) . "
+ </span>
+ </div>
+ " : "") . "
+ </div>
<div class='row mt-auto text-center'>
<div class='col-md-7'></div>
<div class='col-md-2'>
<?= Html::dropDownList('species', null, Products1cNomenclature::find()->select('species')->distinct()->column(), ['class' => 'form-select', 'prompt' => 'Выберите вид', 'id' => 'species']) ?>
</div>
<div class="row mb-2">
- <?= Html::dropDownList('type', null, Products1cNomenclature::find()->select('type_num')->distinct()->column(), ['class' => 'form-select', 'prompt' => 'Выберите тип', 'id' => 'type_num']) ?>
+ <?= Html::dropDownList('type', null, Products1cNomenclature::find()->select('type')->distinct()->column(), ['class' => 'form-select', 'prompt' => 'Выберите тип', 'id' => 'type']) ?>
</div>
<div class="row mb-2">
<?= Html::dropDownList('size', null, Products1cNomenclature::find()->select('size')->distinct()->column(), ['class' => 'form-select', 'prompt' => 'Выберите размер', 'id' => 'size']) ?>