<?php 

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

use common\modules\support\models\redmine\Issue;
use common\modules\support\models\redmine\RedmineHelper;

?>

<div class="container_white support-block">
    <div class="container">
        
        <div class="right_box_top row">
            <div class="col-md-6 col-xs-6 col-sm-12">
                <h2>Создание задачи</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>

        <?php $form = ActiveForm::begin(); ?>

            <div class="row">

                <div class="col-sm-12">
                    <?php $projects = RedmineHelper::sortMemberships($user['user']['memberships']) ?>
                    <?=$form->field($model, 'project_id', ['template' => "<p class='label_p'><strong>{label}</strong></p>\n{input}\n{hint}\n{error}"])->dropDownList($projects, (count($projects)>1?['prompt' => 'Выберите проект']:[]))?>
                </div>

                <div class="col-sm-12">
                    <?=$form->field($model, 'subject', ['template' => "<p class='label_p'><strong>{label}</strong></p>\n{input}\n{hint}\n{error}"])->textInput(['maxlength' => 255, 'placeholder' => 'Дизайн оформления витринных окон для ресторана Subway'])?>
                </div>

                <div class="col-sm-12">   
                    <?=$form->field($model, 'priority_id', ['template' => "<p class='label_p'><strong>{label}</strong></p>\n<div class='important_box important_button_text'>
                        {input}
                        <p class='important_button_text_1'>Важная</p>
                        <p class='important_button_text_2'>Обычная</p>
                        <div class='important_button'></div>
                    </div>\n{hint}\n{error}"])->hiddenInput(['data-simple' => Issue::PRIORITY_SIMPLE, 'data-fire' => Issue::PRIORITY_FIRE])?>
                </div>

            </div>

            <div class="row">
                <div class="col-sm-12">

                    <?=$form->field($model, 'description', ['template' => "<p class='label_p'><strong>{label}</strong></p>\n{input}<br>{hint}{error}"])->widget(\coderlex\markitup\MarkItUp::className(), [
                        'options' => ['class' => 'form-control', 'style' => 'overflow:auto;resize:none;width:100%;min-height:200px;'],
                        'clientOptions' => [
                            'markupSet' => RedmineHelper::$markupSet
                        ],
                    ])?>
            
                </div>
            </div>

            <div class="row">

                <div class="col-sm-12">

                    <div id="file-container">
                        
                    </div>
                    
                    <input type="file" id="file-attachment-input" style="display:none;" multiple="multiple">

                    <div class="gray_button attachment-button">Прикрепить файл<i class="glyphicon glyphicon-paperclip"></i></div>
                    <br>

                    <?= Html::submitButton('Создать задачу', ['class' => 'btn btn-success-2']) ?>

                </div>

            </div>

        <?php ActiveForm::end(); ?>

        <br>

        <br>

    </div>
</div>

<?=$this->render('@app/views/layouts/footer');?>