<h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> </p> <?php $form = ActiveForm::begin(['id' => 'orders-form', 'enableAjaxValidation' => true, 'action' => ['update', 'id' => $model->id]]); ?> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', ['attribute' => 'created', 'format' => ['date', 'php:d.m.Y H:i']], ['attribute' => 'status', 'value' => $form->field($model, 'status')->dropDownList(Orders::$statuses)->label(false) . Html::submitButton('Сохранить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']), 'format' => 'raw'], 'name', 'phone', 'address', ['label' => 'E-mail', 'value' => $model->email], ['attribute' => 'track', 'value' => $form->field($model, 'track')->textInput()->label(false) . Html::submitButton('Сохранить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) . ' ' . Html::a('Отправить трек на почту', ['send-track', 'id' => $model->id], ['class' => 'btn btn-primary', 'onclick' => 'return confirm("Вы действительно хотите отправить трек номер?")']), 'format' => 'raw'], 'description:ntext', ['label' => 'Ссылка на заказ', 'value' => Html::a(Url::toRoute(['/checkout/default/order', 'id' => $model->link_id], 'http'), Url::toRoute(['/checkout/default/order', 'id' => $model->link_id], 'http'), ['target' => '_blank']), 'format' => 'raw'], ['label' => 'Сумма заказа', 'value' => number_format($model->sum, 0, '.', ' ') . ' руб.<br /><br />' . $form->field($model, 'sum_c')->textInput()->hint('Действует только на сумму заказа, без учета доставки') . Html::submitButton('Сохранить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']), 'format' => 'raw'], ['attribute' => 'delivery_cost', 'value' => $form->field($model, 'delivery_cost')->textInput()->label(false) . $form->field($model, 'delivery')->dropDownList(Orders::getDeliveryENum())->label(false) . Html::submitButton('Сохранить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']), 'format' => 'raw'], 'weight', ['attribute' => 'sumWithDelivery', 'value' => !is_null($model->getSumWithDelivery()) ? number_format($model->getSumWithDelivery(), 0, '.', ' ') . ' руб.' : null], ['attribute' => 'comment', 'value' => $form->field($model, 'comment')->textarea()->label(false) . Html::submitButton('Сохранить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']), 'format' => 'raw'], ['label' => 'Добавить товар к заказу', 'value' => $form->field($model, 'newProduct')->label(false)->hint('Начните вводить часть названия товара')->widget(\yii\jui\AutoComplete::className(), ['clientOptions' => ['source' => new \yii\web\JsExpression("function(request, response) {\n \$.getJSON('" . Url::to('find-product') . "', {\n term: request.term\n }, response);\n }"), 'select' => new \yii\web\JsExpression("function(event, ui) { \$(this).val(ui.item.label); addProduct(ui.item.value); return false; }")], 'options' => ['class' => 'form-control']]) . '<a href="#" class="btn btn-success" onclick="pushProduct(); event.preventDefault();">Добавить</a>', 'format' => 'raw'], ['label' => 'Перенести товары из заказа', 'value' => Html::textInput('split_from', null, ['id' => 'split_from', 'class' => 'form-control']) . '<br /><a href="#" class="btn btn-success" onclick="split(); event.preventDefault();">Перенести</a>', 'format' => 'raw']]]); ?> <?php ActiveForm::end(); ?> <?php echo \yii\widgets\ListView::widget(['dataProvider' => $products, 'viewParams' => ['order' => $model], 'itemOptions' => ['class' => 'col-sm-6 col-md-4', 'style' => 'width: auto;'], 'itemView' => '_order-product']); ?> </div> <?php $this->registerJs("\nvar current_product_id = 0;\nfunction addProduct(id) {\n current_product_id = id;\n}\nfunction pushProduct() {\n if (current_product_id === 0) {\n return ;\n }\n window.location.href = '" . Url::to(['add-product']) . "?productId=' + current_product_id + '&orderId=" . $model->id . "';\n}\nfunction split() {\n var from = \$('#split_from').val();\n window.location.href = '" . Url::to(['split']) . "?from=' + from + '&to=" . $model->id . "';\n}\n", \yii\web\View::POS_HEAD);
?> <?php echo $form->field($model, 'email')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'sum_c')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'status')->dropDownList(\stronglab\checkout\models\Orders::$statuses); ?> <?php echo $form->field($model, 'delivery')->dropDownList(\stronglab\checkout\models\Orders::getDeliveryENum()); ?> <?php echo $form->field($model, 'delivery_cost')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'description')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'address')->textarea(['rows' => 6]); ?> <?php
<?php if ($searchModel->status == \stronglab\checkout\models\Orders::STATUS_WAITING_DELIVERY) { ?> / Сумма доставки: <b><?php echo number_format($summary->delivery_sum, 0, '.', ' ') . '</b> руб.'; ?> <?php } ?> <br/><br/> <?php } ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'id', 'value' => function ($model) { return Html::a('#' . $model->id, ['view', 'id' => $model->id]); }, 'format' => 'raw', 'options' => ['style' => 'width: 55px;']], ['attribute' => 'created', 'format' => ['date', 'php:d.m.Y H:i'], 'filter' => DateRangePicker::widget(['model' => $searchModel, 'attribute' => 'created_range', 'pluginOptions' => ['timePicker' => true, 'timePicker24Hour' => true, 'timePickerIncrement' => 10, 'locale' => ['format' => 'DD.MM.YYYY HH:mm']]])], 'name', 'address', ['label' => 'N', 'value' => 'productsCount'], ['label' => 'Сумма заказа', 'value' => function ($model) { return number_format($model->sum, 0, '.', ' ') . ' руб.'; }, 'format' => 'raw'], ['attribute' => 'sumWithDelivery', 'value' => function ($model) { return !is_null($model->sumWithDelivery) ? number_format($model->sumWithDelivery, 0, '.', ' ') . ' руб.' : null; }, 'format' => 'raw'], ['attribute' => 'delivery', 'value' => function ($model) { return $model->getDeliveryText(); }, 'filter' => \stronglab\checkout\models\Orders::getDeliveryENum(false)], ['attribute' => 'status', 'value' => function ($model) { return $model->textStatus; }, 'filter' => \stronglab\checkout\models\Orders::$statuses], ['attribute' => 'comment', 'value' => function ($model) { return StringHelper::truncate($model->comment, 150); }]]]); ?> </div>