public static function getOneAddSupplies($id, $title) { $supl = \backend\modules\supplies\models\Supplies::find()->where(['id' => $id])->one(); $html = ''; $html .= '<tr class="itemPage" page-id="' . $title . '" materials-id="' . $supl->id . '" item-type="materials">'; $html .= '<td><img src="' . $supl->images . '" style = "width:100px;"/></td>'; $html .= '<td>' . $supl->code . '</td>'; $type_materials = Material::find()->where(['id' => $supl->type_mat])->one(); $html .= '<td>' . $type_materials->name . '</td>'; if ($supl->type_blind == 1) { $html .= '<td>Горизонтальные</td>'; } if ($supl->type_blind == 2) { $html .= '<td>Вертикальные</td>'; } if ($supl->type_blind == 3) { $html .= '<td>Рулонные</td>'; } $html .= '<td>' . $supl->type_width . '</td>'; $color = Color::find()->where(['id' => $supl->color])->one(); $html .= '<td><div class="colorSuplies" style="width:50px;height:25px;background: ' . $color->value . '"></div></td>'; $html .= '<td>' . $supl->price . '</td>'; $html .= '<td><a id-materials="' . $supl->id . '"class = "delSuplies" href="#">Открепить</a></td>'; $html .= '</tr>'; return $html; }
/** * Updates an existing Supplies model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $media = Media::find()->orderBy('id DESC')->all(); $type_mat = Material::find()->all(); $type_blind = array(0 => 'Выберите тип жалюзеу', 1 => 'горизонтальные', 2 => 'рулонные', 3 => 'вертикальные'); $arr_tmat[0] = 'Выберите тип материала'; foreach ($type_mat as $v) { $arr_tmat[$v->id] = $v->name; } $color = Color::find()->all(); $arr_color[0] = 'Выберите цвет'; foreach ($color as $v) { $arr_color[$v->id] = $v->value; } if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['update', 'id' => $model->id]); } else { return $this->render('update', ['model' => $model, 'media' => $media, 'type_mat' => $arr_tmat, 'type_blind' => $type_blind, 'color' => $arr_color]); } }
return 'Горизантальные'; } if($model->type_blind == '2'){ return 'рулонные'; } if($model->type_blind == '3'){ return 'вертикальные'; }*/ $arr = ['0' => 'Выберите элемент', '1' => 'Горизантальные', '2' => 'рулонные', '3' => 'вертикальные']; return Html::dropDownList('blind_' . $model->id, $model->type_blind, $arr, ['id' => 'blind_' . $model->id, 'class' => 'blindSelect']); }, 'filter' => Html::dropDownList('SuppliesSearch[type_blind]', $_GET['SuppliesSearch']['type_blind'], ['' => 'Выберите', '1' => 'Горизантальные', '2' => 'рулонные', '3' => 'вертикальные'], ['id' => 'suppliessearch-type_blind', 'class' => 'form-control'])], ['attribute' => 'type_width', 'format' => 'raw', 'value' => function ($model) { return Html::textInput('width_' . $model->id, $model->type_width, ['id' => 'width_' . $model->id, 'class' => 'widthInput', 'style' => 'width:60px;']); //return "<input type='text' value='$model->code' name='code'>"; }], ['attribute' => 'color', 'format' => 'raw', 'value' => function ($model) { $allColor = \common\models\Color::find()->all(); $color = \common\models\Color::find()->where(['id' => $model->color])->one(); $html = Html::hiddenInput('color_' . $model->id, $model->color, ['id' => 'color_' . $model->id, 'class' => 'colorInput']); $html .= '<div class="selectColor" style = "width:100px;height:20px;background-color: ' . $color->value . '"></div>'; $html .= "<div class='allColor'>"; foreach ($allColor as $c) { $html .= "<div class='selectOnecolor' color='{$c->value}' data-sup-id='{$model->id}' data-id='{$c->id}' style='background-color:{$c->value};width: 100px;height: 20px;margin: 5px'></div>"; } $html .= "</div>"; return $html; }, 'filter' => "<input id='colorId' type='hidden' name='SuppliesSearch[color]' value='" . $_GET['SuppliesSearch']['color'] . "'>" . $color], ['attribute' => 'price', 'format' => 'raw', 'value' => function ($model) { return Html::textInput('price_' . $model->id, $model->price, ['id' => 'price_' . $model->id, 'class' => 'priceInput', 'style' => 'width:120px;']); //return "<input type='text' value='$model->code' name='code'>"; }], ['class' => DataColumn::className(), 'header' => 'Прикреплен', 'format' => 'raw', 'value' => function ($model) { $pageItem = \common\models\PageItem::find()->where(['id_item' => $model->id, 'item_type' => 'materials'])->all(); foreach ($pageItem as $p) { $arr[] = $p->id_blind;