| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465 |
- <?php
- use yii\helpers\Html;
- use yii\widgets\DetailView;
- use kartik\file\FileInput;
- use yii\widgets\ActiveForm;
- use kartik\datetime\DateTimePicker;
- use yii\helpers\Url;
- use app\models\Files;
- use app\widgets\ButtonGroupInput;
- /* @var $this yii\web\View */
- /* @var $model app\models\Lots */
- $url = Url::to(['confirm', 'id' => $model->id]);
- $this->registerJs(<<<JS
- $('input[name="status"]').on('change', function(e){
- var self = $(this);
- $.get('$url' + '&status=' + self.val(), function(data){
- if(data !== 1){
- window.location.reload();
- }
- });
- });
- $('input[name="statusOrg"]').on('change', function(e){
- var self = $(this);
- $.get('$url' + '&status=' + self.val(), function(data){
- if(data !== 1){
- window.location.reload();
- }
- });
- });
- JS
- );
- $this->title = $model->name;
- if(Yii::$app->user->can('member')) {
- $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Auction ID'), 'url' => ['/auctions/index']];
- } else {
- $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Lots ID'), 'url' => ['index']];
- }
- $this->params['breadcrumbs'][] = $this->title;
- if(Yii::$app->user->can('admin')) {
- $time_change = Html::button(Yii::t('app', 'Time Value'), ['style' => 'font-weight: bold; text-transform: uppercase; color: black', 'class' => 'btn btn-info btn-sm',
- 'data-toggle' => 'modal', 'data-target' => '#myModal2']);
- $circle_change = Html::button(Yii::t('app', 'Enter value'), ['style' => 'font-weight: bold; text-transform: uppercase; color: black', 'class' => 'btn btn-info btn-sm',
- 'data-toggle' => 'modal', 'data-target' => '#myModal']);
- } else {
- $time_change = '';
- $circle_change = '';
- }
- $circle_down = Html::a(Html::tag('i', '', ['class' => 'glyphicon glyphicon-minus']), ['circle_down', 'id' => $model->id], ['class' => 'btn btn-xs btn-primary']);
- $circle_up = Html::a(Html::tag('i', '', ['class' => 'glyphicon glyphicon-plus']), ['circle_up', 'id' => $model->id], ['class' => 'btn btn-xs btn-primary']);
- $status = ButtonGroupInput::widget([
- 'name' => 'status',
- 'items' => [
- '1' => Yii::t('app', 'Обробляється'),
- '2' => Yii::t('app', 'Узгоджено'),
- '3' => Yii::t('app', 'Відхилено'),
- ],
- 'value' => $model->status
- ]);
- $statusOrg = ButtonGroupInput::widget([
- 'name' => 'status',
- 'items' => [
- '3' => Yii::t('app', 'Відхилено'),
- '4' => Yii::t('app','Узгоджено організатором'),
- ],
- 'value' => $model->status
- ]);
- if($model->docs_id) {
- $docs = Html::a(Yii::t('app', 'Download ID'), ['/files/download', 'id' => $model->docs_id], ['class' => 'glyphicon glyphicon-circle-arrow-down']);
- } else {
- $docs = NULL;
- }
- if($model->dogovor_id) {
- $dogovor = Html::a(Yii::t('app', 'Download ID'), ['/files/download', 'id' => $model->dogovor_id], ['class' => 'glyphicon glyphicon-circle-arrow-down']);
- } else {
- $docs = NULL;
- }
- if($model->nds == 1) {
- $price_nds = $model->start_price . " " . Yii::t('app', 'zNDS ID');
- } else {
- $price_nds = $model->start_price . " " . Yii::t('app', 'bNDS ID');
- }
- $registration_fee = $model->start_price * 0.0015;
- $guarantee_fee = $model->start_price * 0.015;
- //ivakhnov
- $js = '$("#button-save").on("click",function(e){
- var value = $("#input-save").val();
- var id = ' . $model->id . ';
- if(value.length > 0){
- $.post("' . Url::to(['/lots/step-change']) . '",
- {
- value: value,
- id: id
- },);
- }
- });
- $("#lot-form").on("beforeSubmit", function(e){
- if($("input[name=\"status\"]:checked").val() != 2){
- alert("' . Yii::t('app', 'Необхідно узгодити лот') . '");
- return false;
- }
- });
- $("input[name=\"type\"]").on("change", function(e){
- var self = $(this),
- form = $("#lot-form");
- form.attr("action", "/lots/auction?" + self.val() + "?id=' . $model->id . '");
- form.attr("action", "/lots/auction?id=' . $model->id . '&type=" + self.val());
- });
- $("#button-save2").on("click",function(e){
- var val1 = $("#input-save1").val();
- var val2 = $("#input-save2").val();
- var val3 = $("#input-save3").val();
-
-
- var value1 = value2 = value3 = 0;
- if(val1 > 0){
- value1 = val1;
- }
- if(val2 > 0){
- value2 = val2;
- }
- if(val3 > 0){
- value3 = val3;
- }
-
- var concat_val = value1 + ":"+ value2 + ":" + value3;
-
-
- var id = ' . $model->id . ';
-
- if(concat_val.length > 0){
- $.post("' . Url::to(['/lots/time-step-change']) . '",
- {
- concat_val: concat_val,
- id: id
- },
- function(data){
-
- }
- );
- }
- });
- $(document).ready(function () {
- $(\'input[type=checkbox]\').change(function(){
- $(this).parent().siblings().children().filter(\':checked\').not(this).removeAttr(\'checked\');
- });
- });
- ';
- $this->registerJs($js);
- //--------
- ?>
- <!-- Modal by Ivakhnov -->
- <!-- Modal -->
- <div class="modal fade" id="myModal" role="dialog">
- <div class="modal-dialog modal-sm">
- <!-- Modal content-->
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal">×</button>
- <h4 class="modal-title"><?= Yii::t('app', 'Circle ID') ?></h4>
- </div>
- <div class="modal-body">
- <p><input type="number" class="form-control" value="<?= $model->step_down ?>" id="input-save"></p>
- </div>
- <div class="modal-footer">
- <?= Html::button(Yii::t('app', 'Save'), ['class' => 'btn btn-default', 'id' => 'button-save']) ?>
- <button type="button" class="btn btn-default" data-dismiss="modal"><?= Yii::t('app', 'Close') ?></button>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" id="myModal2" role="dialog">
- <div class="modal-dialog modal-sm">
- <!-- Modal content-->
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal">×</button>
- <h4 class="modal-title"><?= Yii::t('app', 'Circle ID') ?></h4>
- </div>
- <div class="modal-body">
- <div class="container-fluid">
- <div class="row">
- <div class="col-xs-4">
- <div class="form-group">
- <label for=""><?= Yii::t('app', 'Години'); ?></label>
- <input type="number" class="form-control" placeholder="Години" value="0" id="input-save1">
- </div>
- </div>
- <div class="col-xs-4">
- <div class="form-group">
- <label for=""><?= Yii::t('app', 'Хвилини'); ?></label>
- <input type="number" class="form-control" placeholder="Хвилини" max="59" value="10" id="input-save2">
- </div>
- </div>
- <div class="col-xs-4">
- <div class="form-group">
- <label for=""><?= Yii::t('app', 'Секунди'); ?></label>
- <input type="number" class="form-control" placeholder="Секунди" max="59" value="0" id="input-save3">
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <?= Html::button(Yii::t('app', 'Save'), ['class' => 'btn btn-default', 'id' => 'button-save2']) ?>
- <button type="button" class="btn btn-default" data-dismiss="modal"><?= Yii::t('app', 'Close') ?></button>
- </div>
- </div>
- </div>
- </div>
- <div class="panel panel-primary">
- <div class="panel-heading"><span class="glyphicon glyphicon-stats"></span><strong>
- <?= Html::encode($this->title) ?></strong>
- <?php if (Yii::$app->user->id == $model->user_id || Yii::$app->user->can('admin')): ?>
- <?php if(Yii::$app->user->can('org') || Yii::$app->user->can('admin')): ?>
- <?= Html::a(Yii::t('app', 'Update ID'), ['update', 'id' => $model->id], ['class' => 'btn btn-warning']); ?>
- <?= Html::a(Yii::t('app', 'Delete ID'), ['delete', 'id' => $model->id], [
- 'class' => 'btn btn-danger',
- 'data' => [
- 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
- 'method' => 'post',
- ]]); ?>
- <?php endif; ?>
- <?php endif; ?>
- </div>
- <div class="panel-body">
- <div class="lots-view">
- <div class="container">
- <div class="row">
- <div class="col-sm-12">
- <?= $this->render('_alert.php') ?>
- <?php
- if(Yii::$app->user->can('admin'))
- {
- ActiveForm::begin([
- 'action' => ['/lots/auction', 'id' => $model->id, 'type' => 1],
- 'id' => 'lot-form',
- ]); ?>
- <div class="row">
- <div class="col-sm-3">
- <label for=""><?= Yii::t('app', 'Час продовження, хв'); ?></label>
- <br>
- <?= ButtonGroupInput::widget([
- 'name' => 'time_cont',
- 'items' => ['00:05' => Yii::t('app', '5 хвилин'), '00:10' => Yii::t('app', '10 хвилин')],
- 'value' => '00:05',
- ]); ?>
- </div>
- <div class="col-sm-5">
- <label for="type"><?= Yii::t('app', 'Тип аукціону'); ?></label>
- <br>
- <?= ButtonGroupInput::widget([
- 'name' => 'type',
- 'items' => [
- '1' => Yii::t('app', 'Підвищення'),
- '2' => Yii::t('app', 'Голландський'),
- '3' => Yii::t('app', 'Банкрутство'),
- ],
- 'value' => '1',
- ]); ?>
- </div>
- <div class="col-sm-2">
- <label for="date_stop"><?= Yii::t('app', 'Дата закінчення'); ?></label>
- <br>
- <?= DateTimePicker::widget([
- 'layout' => '{picker}{input}',
- 'value' => date('Y-m-d H:i', time() + 360),
- 'name' => 'date_stop',
- 'options' => ['placeholder' => Yii::t('app', 'DateStop ID')],
- 'pluginOptions' => [
- 'autoclose' => true,
- 'format' => 'yyyy-mm-dd hh:ii',
- ],
- ]); ?>
- </div>
- <div class="col-sm-2">
- <label for=""> </label>
- <br>
- <?php if(Yii::$app->user->can('admin')): ?>
- <?= Html::submitButton(Yii::t('app', 'Створити'), ['class' => 'btn btn-success']); ?>
- <?php elseif(Yii::$app->user->can('org')): ?>
- <?= Html::a('←До Аукціонів', ['lots/index'], ['class' => 'btn btn-info']) ?>
- <?php endif;?>
- </div>
- </div>
- <?php ActiveForm::end(); ?>
- </div>
- <div class="row">
- <div class="col-xs-12">
- <hr>
- </div>
- <div class="col-sm-2">
- <p class="lead"><?= Yii::t('app', 'Статус'); ?>:</p>
- </div>
- <div class="col-sm-4">
- <?= $status; ?>
- </div>
- </div>
- <hr>
- </div>
- <?php
- } else {
- $files = new Files();
- if(false != ($file = Files::findOne([
- 'user_id' => Yii::$app->user->id,
- 'type' => 'bid',
- 'lot_id' => $model->id,
- ]))) {
- $bidding = new \app\models\Bidding();
- $form = ActiveForm::begin([
- 'action' => Url::to(['/auctions/bid', 'id' => $model->auction->id]),
- ]); ?>
- <?= $form->field($bidding, 'special_price'); ?>
- <div class="form-group">
- <?= Html::submitButton(Yii::t('app', 'Submit'), ['class' => 'btn btn-success']); ?>
- <?= Html::a(Yii::t('app', 'Download file'), ["/files/download", 'id' => $file->id], ['class' => 'btn btn-warning']); ?>
- </div>
- <?php
- ActiveForm::end();
- } else {
- $form = ActiveForm::begin([
- 'options' => ['enctype' => 'multipart/form-data'] // important
- ]);
- echo $form->field($files, 'file')->widget(FileInput::classname(), [
- 'options' => ['multiple' => true],
- 'pluginOptions' => [
- 'initialCaption' => 'файл типу: doc, docx, pdf, jpg, png, zip, rar (розмiр не бiльше 40Мб)',
- 'showPreview' => true,
- 'overwriteInitial' => false,
- 'pluginLoading' => true,
- 'initialPreviewAsData' => true,
- 'uploadClass' => 'btn btn-danger',
- 'removeIcon' => '<i class="glyphicon glyphicon-trash"></i>',
- ],
- ])->label(Yii::t('app', 'DownloadMemeberDoc ID'));
-
- ActiveForm::end();
- }
- }
- ?>
- <?= DetailView::widget([
- 'model' => $model,
- 'attributes' =>
- [
- [
- 'label' => Yii::t('app', 'Circle ID'),
- 'value' => $circle_down . Html::tag('span', $model->step_down, ['class' => 'lead']) . $circle_up . $circle_change . $time_change . $model->time_step_down,
- 'format' => 'raw',
- ],
- 'aukname',
- 'name',
- 'categoryName',
- 'description',
- 'auction_date',
- 'bidding_date',
- [
- 'attribute' => 'start_price',
- 'value' => $price_nds,
- ],
- [
- 'attribute' => 'count',
- 'value' => $model->count,
- 'visible' => $model->count,
- ],
- [
- 'attribute' => 'price_per_one',
- 'value' => $model->unitId ? ($model->start_price / $model->count) : '',
- 'visible' => $model->unitId ? true : false,
- ],
- [
- 'attribute' => 'unitName',
- 'value' => $model->unit ? $model->unit->name : '',
- 'visible' => $model->unitId ? true : false,
- ],
- 'step',
- [
- 'attribute' => 'docs_id',
- 'value' => $docs,
- 'format' => 'raw',
- ],
- 'address',
- 'member_require',
- 'payment_term',
- 'notes',
- [
- 'attribute' => 'dogovor_id',
- 'value' => $dogovor,
- 'format' => 'raw',
- ],
- [
- 'attribute' => Yii::t('app', 'Registration fee'),
- 'value' => $registration_fee .
- Html::a('<i class="glyphicon glyphicon-circle-arrow-down"></i>',
- [
- '/bills/download-requisites',
- 'id' => $model->billPayRegistration,
- ],
- [
- 'target' => '_blank',
- 'title' => Yii::t('app', 'Download bill')
- ]
- ),
- 'format' => 'raw',
- ],
- [
- 'attribute' => Yii::t('app', 'Guaranteed payment'),
- 'value' => $guarantee_fee .
- Html::a('<i class="glyphicon glyphicon-circle-arrow-down"></i>',
- [
- '/bills/download-requisites',
- 'id' => $model->billPayGuarantee,
- ],
- [
- 'target' => '_blank',
- 'title' => Yii::t('app', 'Download bill')
- ]
- ),
- 'format' => 'raw',
- ],
- ],
- ]) ?>
- </div>
- </div>
- </div>
|