<%= @workflow.name %>

<% if @workflow.description.present? %>

<%= @workflow.description %>

<% end %>

프로젝트: <%= @workflow.project&.name || '모든 프로젝트' %> | 트래커: <%= @workflow.tracker&.name || '모든 트래커' %> | 상태: <%= @workflow.active ? '활성' : '비활성' %> <% if @workflow.is_default %> | 기본 워크플로우 <% end %>


워크플로우 단계

<%= form_tag custom_workflow_steps_path(@workflow), method: :post, class: 'tabular' do %>

<%= text_field_tag 'workflow_step[name]', '', size: 20, required: true, placeholder: '예: 개발, QA...' %>   <%= select_tag 'workflow_step[issue_status_id]', options_from_collection_for_select(IssueStatus.sorted, :id, :name), include_blank: '-- 선택 --', style: 'width: 150px;' %>   <%= submit_tag '단계 추가', class: 'button-positive' %>

<% end %>
<% if @steps.any? %> <% @steps.each_with_index do |step, idx| %> <% end %>
순서 단계명 이슈 상태 기한(일) 담당자 작업
<%= idx + 1 %> <% if step.is_start %>
시작 <% end %> <% if step.is_end %>
종료 <% end %>
<%= step.name %> <% if step.description.present? %>
<%= step.description %> <% end %>
<%= form_tag custom_workflow_step_path(@workflow, step), method: :patch, style: 'display: inline;' do %> <%= select_tag 'workflow_step[issue_status_id]', options_from_collection_for_select(IssueStatus.sorted, :id, :name, step.issue_status_id), include_blank: '-- 선택 --', style: 'font-size: 11px; padding: 2px;', onchange: 'this.form.submit();' %> <% end %> <%= form_tag custom_workflow_step_path(@workflow, step), method: :patch, style: 'display: inline;' do %> <%= number_field_tag 'workflow_step[due_days]', step.due_days, min: 1, max: 365, style: 'width: 50px; font-size: 11px; padding: 2px;', placeholder: '-', onchange: 'this.form.submit();' %> <% end %> <% if step.workflow_step_assignees.any? %> <% step.workflow_step_assignees.each do |assignee| %> <%= assignee.assignee_name %> <%= link_to '×', step_assignee_path(step_id: step.id, id: assignee.id), method: :delete, style: 'color: #dc3545; margin-left: 5px;', title: '제거' %> <% end %> <% else %> 담당자 없음 <% end %>
+ 담당자 추가
<%= link_to '▲', move_custom_workflow_step_path(@workflow, step, direction: 'up'), method: :patch, class: 'icon', title: '위로' unless idx == 0 %> <%= link_to '▼', move_custom_workflow_step_path(@workflow, step, direction: 'down'), method: :patch, class: 'icon', title: '아래로' unless idx == @steps.length - 1 %> | <%= link_to '삭제', custom_workflow_step_path(@workflow, step), method: :delete, data: { confirm: '이 단계를 삭제하시겠습니까?' }, class: 'icon icon-del' %>
<% else %>

단계가 없습니다. 위에서 단계를 추가하세요.

<% end %>

<%= link_to '목록으로', '/custom_workflows', class: 'icon icon-back' %> <%= link_to '수정', edit_custom_workflow_path(@workflow), class: 'icon icon-edit' %>

<%= javascript_tag do %> var currentStepId = null; var searchTimeout = null; function showAssigneeModal(stepId) { currentStepId = stepId; document.getElementById('modal-step-id').value = stepId; document.getElementById('assignee-modal').style.display = 'block'; document.getElementById('assignee-search').value = ''; loadAssigneeOptions(); } function closeAssigneeModal() { document.getElementById('assignee-modal').style.display = 'none'; currentStepId = null; } function loadAssigneeOptions() { var type = document.getElementById('assignee-type').value; var query = document.getElementById('assignee-search').value; var listDiv = document.getElementById('assignee-list'); var url = ''; if (type === 'user') { url = '<%= search_users_workflows_path %>'; } else if (type === 'role_group') { url = '<%= search_role_groups_workflows_path %>'; } else if (type === 'department') { url = '<%= search_departments_workflows_path %>'; } $.ajax({ url: url, data: { q: query }, dataType: 'json', success: function(data) { var html = ''; if (data.length === 0) { html = '

결과 없음

'; } else { html = ''; data.forEach(function(item) { var label = item.name; if (item.count !== undefined) { label += ' (' + item.count + '명)'; } if (item.login) { label += ' - ' + item.login; } html += ''; html += ''; html += ''; html += ''; }); html += '
' + label + ''; html += '
'; html += ''; html += ''; html += ''; html += ''; html += '
'; html += '
'; } listDiv.innerHTML = html; } }); } $('#assignee-search').on('keyup', function() { if (searchTimeout) clearTimeout(searchTimeout); searchTimeout = setTimeout(loadAssigneeOptions, 300); }); // 모달 외부 클릭시 닫기 document.getElementById('assignee-modal').addEventListener('click', function(e) { if (e.target === this) closeAssigneeModal(); }); <% end %>