<?php /*
  新建任务弹窗表单。
  样式统一在 assets/css/custom_dashboard.css 第 10 节「任务【新建】弹窗 — 表单布局」维护。
  本模板不再内联 <style>。弹窗通用外观见同文件第 11 节。
*/ ?>
<div class="page-header">
    <h2><?= $this->text->e($project['name']) ?> &gt; <?= t('New task') ?></h2>
</div>
<form method="post" action="<?= $this->url->href('TaskCreationController', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off">
    <?= $this->form->csrf() ?>

    <div class="custom-task-form-container">
        <div class="custom-task-form-main">
            <div class="form-row form-row-top joined-input-group">
                <div class="form-col"><?= $this->task->renderColorField($values) ?></div>
                <div class="form-col"><?= $this->task->renderPriorityField($project, $values) ?></div>
            </div>
            <?= $this->task->renderTitleField($values, $errors) ?>
            <?= $this->task->renderTagField($project) ?>
            <?= $this->task->renderDescriptionField($values, $errors) ?>
            <?= $this->task->renderDescriptionTemplateDropdown($project['id']) ?>

            <?= $this->hook->render('template:task:form:first-column', array('values' => $values, 'errors' => $errors)) ?>
        </div>

        <div class="custom-task-form-secondary">
            <div class="form-row form-row-top form-row-gap">
                <div class="form-col form-col-selectors">
                    <?= $this->task->renderCategoryField($categories_list, $values, $errors) ?>
                    <?= $this->task->renderSwimlaneField($swimlanes_list, $values, $errors) ?>
                    <?= $this->task->renderColumnField($columns_list, $values, $errors) ?>
                </div>
                <div class="form-col form-col-assignee">
                    <?= $this->task->renderAssigneeField($users_list, $values, $errors) ?>
                </div>
            </div>

            <?= $this->hook->render('template:task:form:second-column', array('values' => $values, 'errors' => $errors)) ?>

            <div class="attachment-area-wrapper">
                <div class="attachment-area-title"><?= t('Add attachments') ?></div>
                <details class="accordion-section" open style="margin-bottom:0;">
                    <summary class="accordion-title" style="display:none;"><?= t('Add attachments') ?></summary>
                    <div class="accordion-content custom-attachments-content" style="margin-top:0;">
                        <?= $this->task->renderFileUpload($screenshot, $files) ?>
                    </div>
                </details>
            </div>
            
            <?= $this->hook->render('template:task:form:bottom-before-buttons', array('values' => $values, 'errors' => $errors)) ?>
        </div>

        <div class="custom-task-form-tertiary">
            <?= $this->task->renderStartDateField($values, $errors) ?>
            <?= $this->task->renderDueDateField($values, $errors) ?>
            <?= $this->task->renderTimeEstimatedField($values, $errors) ?>
            <?= $this->task->renderTimeSpentField($values, $errors) ?>
            <?= $this->task->renderScoreField($values, $errors) ?>
            <?= $this->task->renderReferenceField($values, $errors) ?>

            <?= $this->hook->render('template:task:form:third-column', array('values' => $values, 'errors' => $errors)) ?>

            <div class="form-actions-wrapper">
                <?php if (! isset($duplicate)): ?>
                    <div class="checkbox-group">
                        <?= $this->form->checkbox('another_task', t('Create another task'), 1, isset($values['another_task']) && $values['another_task'] == 1, '', array("tabindex" => "16")) ?>
                        <?= $this->form->checkbox('duplicate_multiple_projects', t('Duplicate to multiple projects'), 1, false, '', array("tabindex" => "17")) ?>
                    </div>
                <?php endif ?>
                <div class="submit-buttons-wrapper">
                    <a href="#" class="js-modal-close btn btn-cancel">取消</a>
                    <button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
                </div>
            </div>
        </div>
    </div>
</form>
