'verbs' => [
'class' => VerbFilter::class,
'actions' => [
- //'delete' => ['POST'],
+
],
],
[
'class' => TimestampBehavior::class,
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
- //'deletedAtAttribute' => 'deleted_at',
+
'value' => new \yii\db\Expression('NOW()'),
],
]
->select('guid_replacement')
->where(['guid' => $model->guid])
->andWhere(['deleted_at' => null])
- // ->distinct()
->column();
}
if ($guid) {
- if ($guid == "guid"){
+ if ($guid == "guid") {
$existingGuids = Product1cReplacement::find()
->select(['guid'])
->distinct()
try {
$replacementData = $this->request->post('Product1cReplacement')['guid_replacement'] ?? [];
$replacementIds = $this->request->post('Product1cReplacement')['replacement_ids'] ?? [];
- //var_dump($replacementData); die();
+
foreach ($replacementData as $index => $replacementGuid) {
if (!empty($replacementIds[$index])) {
'dataType' => 'json',
'data' => new JsExpression('function(params) { return {q:params.term, guid: "guid"}; }'),
'processResults' => new JsExpression('function(data) {
- return {
- results: $.map(data.items, function(item) {
return {
- id: item.id,
- text: item.text
+ results: $.map(data.items, function(item) {
+ return {
+ id: item.id,
+ text: item.text
+ };
+ })
};
- })
- };
- }'),
+ }'),
],
],
]) ?>
- <p class="text-danger">Внимание! Если товар не найден, проверьте общий список - возможно товар уже присутствует в списке замен</p>
+ <p class="text-danger">Внимание! Если товар не найден,
+ проверьте общий список - возможно товар
+ уже присутствует в списке замен</p>
</div>
</div>
'url' => \yii\helpers\Url::to(['/crud/product1c-replacement/search']),
'dataType' => 'json',
'data' => new JsExpression('function(params) {
- var exclude = [];
- exclude.push($("#product1creplacement-guid").val());
- $(".guid-replacement-select").each(function() {
- if ($(this).val()) {
- exclude.push($(this).val());
- }
- });
- return {
- q: params.term,
- exclude: exclude.join(","),
- guid: $("#guid-select").val()
- };
- }'),
- 'processResults' => new JsExpression('function(data) {
- return {
- results: $.map(data.items, function(item) {
+ var exclude = [];
+ exclude.push($("#product1creplacement-guid").val());
+ $(".guid-replacement-select").each(function() {
+ if ($(this).val()) {
+ exclude.push($(this).val());
+ }
+ });
return {
- id: item.id,
- text: item.text
+ q: params.term,
+ exclude: exclude.join(","),
+ guid: $("#guid-select").val()
};
- })
- };
- }'),
+ }'),
+ 'processResults' => new JsExpression('function(data) {
+ return {
+ results: $.map(data.items, function(item) {
+ return {
+ id: item.id,
+ text: item.text
+ };
+ })
+ };
+ }'),
],
],
]) ?>
?>
<div class="product1-creplacement-update p-4">
<?= Html::a('Отмена', ['index'], ['class' => 'btn btn-danger mb-4']) ?>
- <h1><?= Html::encode($this->title) ?> <br> <?= $model->product->name ?> (<?= $model->product->id ?> , <?= $model->product->articule ?>) </h1>
+ <h1><?= Html::encode($this->title) ?> <br>
+ <?= $model->product->name ?>
+ (<?= $model->product->id ?>, <?= $model->product->articule ?>) </h1>
<?= $this->render('multy-form', [
'model' => $model,