<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\file\FileInput;
use kato\DropZone;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model common\models\Test */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="test-form">
<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>
<?= $form->field($model, 'file')->widget(\kartik\file\FileInput::className(),[
'options' => ['accept' => 'image/*'],
'pluginOptions' => [
'showCaption' => false,
'showRemove' => false,
'showUpload' => false,
'browseClass' => 'btn btn-primary btn-block',
'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ',
'browseLabel' => 'Select Photo'
],
]);
?>
<?= $form->field($model, 'files')->widget(\kartik\file\FileInput::className(),[
'options' => ['accept' => 'img/*'],
'pluginOptions' => [
'showCaption' => false,
'showRemove' => false,
'showUpload' => false,
'browseClass' => 'btn btn-primary btn-block',
'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ',
'browseLabel' => 'Select Photo'
],
]);
?>
<?= $form->field($model, 'photo')->fileInput() ?>
<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<div class="container">
<?php if(!empty($session['cart'])): ?>
<div class="table-responsive">
<table class="table table-hover table-striped">
<thead>
<tr>
<th></th>
<th>Название</th>
<th>Кол-во</th>
<th></th>
<th>Цена</th>
<th>Всего</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($session['cart'] as $id => $item ): ?>
<tr>
<td><?= \yii\helpers\Html::img("@web/uploads/{$item['img']}", ['alt' => $item['name'], 'height'=>100] )?></td>
<td><?= $item['name'] ?></td>
<td><div class="input-group">
<input id="<?= $id ?>" type="text" class="form-control input-number quantity" value="<?= $item['qty'] ?>">
<a href="cart" data-id="<?= $id ?>" class="btn btn-default addd"><i class="fas fa-sync"></i></a>
</div>
</td>
<td><input style="min-width: 50px" class="form-control input-number readonly price" type="text" readonly value="<?= $item['base_unit'] ?> "/></td>
<td><input style="min-width: 50px" class="form-control input-number readonly price" type="text" readonly value="<?=$item['price']?> " /></td>
<td><input style="min-width: 60px" class="form-control input-number total" type="text" readonly value="<?= $item['qty'] * $item['price']?> " class="readonly"/></td>
<td><a type="button" data-id="<?= $id ?>" class="sil btn btn-danger">Удалить</a></td>
</tr>
<?php endforeach; ?>
<tr>
<td colspan="5">Итого:</td>
<td><?= $session['cart.qty'] ?></td>
</tr>
<tr>
<td colspan="5">Сумма:</td>
<td><?= $session['cart.sum'] ?></td>
</tr>
</tbody>
</table>
<input style="min-width: 50px" class="form-control input-number readonly price" type="text" id="endirim"/>
<a type="button" href="cart" class="endirim btn btn-success">Купон Скидки</a>
</div>
</hr>
<?php $form = ActiveForm::begin() ?>
<?= $form->field($order, 'name') ?>
<?= $form->field($order, 'email') ?>
<?= $form->field($order, 'phone') ?>
<?= $form->field($order, 'address') ?>
<?= Html::submitButton('Заказать',['class' => 'btn btn-success']) ?>
<?php $form = ActiveForm::end() ?>
<?php else: ?>
<h3>Корзина пусто</h3>
<?php endif; ?>
</div>