<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\ActiveForm;

use common\modules\support\models\redmine\IssueHelper;

?>

<div class="client_interface">

    <div class="container">
        
        <div class="right_box_top row">
            <div class="col-md-6 col-xs-6 col-sm-12">
                <h2><strong>Список задач</strong></h2>
            </div>
            <div class="col-md-6 col-xs-6 col-sm-12">
                <div class="logo_taskon">
                    <span>Разработанно в:  </span>
                    <a href=""><img src="/images/logo_taskon.png" height="44" width="135" alt=""></a>
                </div>
            </div>
        </div>
        
        <div class="right_box_top row">

            <div class="col-md-3 col-xs-3 col-sm-12 dropdown-menu-my">
        
                <?=Html::a('<span class="glyphicon glyphicon-plus"></span> Добавить задачу', ['/support/create'], ['class' => 'btn btn-success-2  dropdown-menu-my-button'])?>
        
            </div>
        
            <div class="col-md-9 col-xs-9 col-sm-12">
                
                <?php $form = ActiveForm::begin([
                    'method' => 'GET',
                    'action' => '/support',
                    'options' => [
                        'class' => 'search-form'
                    ]
                ]); ?>
                    <div class="input-group">
                        <?=Html::textInput('s', Yii::$app->request->get('s'), ['class' => 'form-control']); ?>

                        <span class="input-group-btn">
                            <?= Html::submitButton('<span class="glyphicon glyphicon-search"></span>', ['class' => 'btn btn-default-2 btn-size-2']) ?>
                        </span>
                    </div>
                <?php ActiveForm::end(); ?>
                
            </div>
        
        </div>
        
        <br>
     

        <div class="table-responsive table-responsive-conf">
            
            <table class="table">
                <tr>
                    <td class="no_pad">

                        <?php 
                        if($issues = IssueHelper::sort($models['issues']))
                        {
                            foreach ($issues as $issue) 
                            {
                                if(!isset($issue['close']))
                                {
                                    echo $this->render('_loop', ['output' => $issue['models'], 'title' => $issue['title']]);
                                }
                                else
                                {
                                    $accepteds = $issue['models'];
                                }
                            }
                        }
                        ?>

                    </td>
                </tr>
            </table>
        </div>

        <br>
       
        <?php if($accepteds) : ?>
            <a href="#" class="separator_close">Закрытые задачи</a>

            <?php foreach ($accepteds as $model) : ?>

                <div class="panel-body panel-body-ex-1 panel-body-ex-2">
                    <div  data-toggle="buttons">
                        <label class="btn pull-left active">
                            <input type="checkbox">
                        </label>
                        <div class="text-mes">
                            <p><?=$model['subject']?></p>
                        </div>
                  
                    </div>
                </div>

            <?php endforeach; ?>
        <?php endif; ?>
      
        <br>
        <br>

    </div>
</div>