<?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">
    <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">
                    <?=$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-md-3 col-xs-6 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-md-3 col-xs-6 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' => [    
                                [
                                    'name' => 'Жирный',
                                    'className' => 'fa fa-bold',
                                    'openWith' => '*',
                                    'closeWith' => '*'
                                ],
                                [
                                    'name' => 'Курсив',
                                    'className' => 'fa fa-italic',
                                    'openWith' => '_',
                                    'closeWith' => '_'
                                ],
                                [
                                    'name' => 'Подчеркнутый',
                                    'className' => 'fa fa-underline',
                                    'openWith' => '+',
                                    'closeWith' => '+'
                                ],
                                [
                                    'name' => 'Зачеркнутый',
                                    'className' => 'fa fa-strikethrough',
                                    'openWith' => '-',
                                    'closeWith' => '-'
                                ],
                                ['separator' => '---------------'],
                                [
                                    'name' => 'Заголовок 1',
                                    'className' => 'fa fa-header header-1',
                                    'openWith' => 'h1. ',
                                    'closeWith' => ''
                                ],
                                [
                                    'name' => 'Заголовок 2',
                                    'className' => 'fa fa-header header-2',
                                    'openWith' => 'h2. ',
                                    'closeWith' => ''
                                ],
                                [
                                    'name' => 'Заголовок 3',
                                    'className' => 'fa fa-header header-3',
                                    'openWith' => 'h3. ',
                                    'closeWith' => ''
                                ],
                                ['separator' => '---------------'],
                                [
                                    'name' => 'Маркированный список',
                                    'className' => 'fa fa-list-ul',
                                    'openWith' => '* ',
                                    'multiline' => true,
                                    'openBlockWith' => "",
                                    'closeBlockWith' => ""
                                ],
                                [
                                    'name' => 'Нумерованный список',
                                    'className' => 'fa fa-list-ol',
                                    'openWith' => '# ',
                                    'multiline' => true,
                                    'openBlockWith' => "",
                                    'closeBlockWith' => ""
                                ],
                                ['separator' => '---------------'],
                                [
                                    'name' => 'Заранее форматированный тест',
                                    'className' => 'fa fa-newspaper-o',
                                    'openWith' => '<pre>',
                                    'closeWith' => '</pre>'
                                ],
                                ['separator' => '---------------'],
                                [
                                    'name' => 'Вставка изображения',
                                    'className' => 'fa fa-picture-o',
                                    'openWith' => '!',
                                    'closeWith' => '!'
                                ],
                            ]
                        ],
                    ])?>
            
                </div>
            </div>

            <div class="row">

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

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

                </div>

            </div>

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

        <br>

        <br>

    </div>
</div>

<style type="text/css">
    .markItUpButton {
        position: relative;
        width: 23px;
        height: 23px;
        padding: 3px;
        font-size: 13px;
        text-align: center;
    }
    .markItUpButton a {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 5;
    }
    .markItUp {
        width: 100%;
        margin: 5px 0 5px 0;
    }
    .header-2 {
        font-size: 11px;
        line-height: 16px;
    }
    .header-3 {
        font-size: 9px;
        line-height: 16px;
    }
</style>

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