Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

5.8 KB
Raw Blame
<%= render NeoTitleBoxComponent.new(
  title: t('views.organisations.ticket_attribute_definitions.merge_option.title'),
  subtitle: @attribute_definition.label_for(I18n.locale),
  variant: :organisation
) do |c| %>
  <% c.with_right_content do %>
    <%= render Neo::Buttons::HeaderButtonComponent.new(
      variant: :secondary,
      icon: "x-lg",
      label: t('views.organisations.ticket_attribute_definitions.merge_option.cancel'),
      url: edit_organisation_project_ticket_attribute_definition_path(@current_organisation, @project, @attribute_definition)
    ) %>
  <% end %>
<% end %>

<div class="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
  <div class="bg-cream-50 rounded-lg border border-cream-300 shadow-[2px_2px_0_0_#14110c] p-6">
    <div class="flex items-center gap-6 mb-6 pb-6 border-b border-cream-200">
      <div>
        <p class="text-sm text-cream-600"><%= t('views.organisations.ticket_attribute_definitions.merge_option.project_label') %></p>
        <p class="font-bold text-cream-900"><%= @project.name %></p>
      </div>
      <div>
        <p class="text-sm text-cream-600"><%= t('views.organisations.ticket_attribute_definitions.merge_option.attribute_label') %></p>
        <p class="font-bold text-cream-900"><%= @attribute_definition.label_for(I18n.locale) %></p>
      </div>
      <div>
        <p class="text-sm text-cream-600"><%= t('views.organisations.ticket_attribute_definitions.merge_option.field_type_label') %></p>
        <p class="font-bold text-cream-900"><%= @attribute_definition.field_type %></p>
      </div>
    </div>

    <%= form_with url: execute_merge_organisation_project_ticket_attribute_definition_path(@current_organisation, @project, @attribute_definition), method: :patch do |f| %>
      <%= hidden_field_tag :source_value, @source_value %>

      <div class="space-y-6">
        <!-- Quell-Option -->
        <div>
          <label class="block text-sm font-medium text-cream-800 mb-2"><%= t('views.organisations.ticket_attribute_definitions.merge_option.source_option_label') %></label>
          <div class="flex items-center gap-3 p-4 bg-red-50 border-2 border-red-200 rounded-lg">
            <% source_color = TicketAttributeDefinition.safe_option_color(@source_option['color'], TicketAttributeDefinition::OPTION_COLOR_FALLBACK) %>
            <span class="inline-block w-4 h-4 rounded-full border border-stroke" style="background-color: <%= source_color %>"></span>
            <span class="font-bold text-lg"><%= @source_value %></span>
            <span class="ml-auto inline-flex items-center gap-1 text-sm text-red-700">
              <i class="bi bi-trash"></i>
              <%= t('views.organisations.ticket_attribute_definitions.merge_option.will_be_removed') %>
            </span>
          </div>
        </div>

        <!-- Ziel-Option -->
        <div>
          <label for="target_value" class="block text-sm font-medium text-cream-800 mb-2"><%= t('views.organisations.ticket_attribute_definitions.merge_option.target_option_label') %></label>
          <select name="target_value" id="target_value"
                  class="w-full px-4 py-2 bg-surface-raised border border-cream-300 rounded-lg focus:outline-none focus:border-ink focus:ring-1 focus:ring-ink"
                  required>
            <option value="" disabled selected><%= t('views.organisations.ticket_attribute_definitions.merge_option.target_option_prompt') %></option>
            <% @target_options.each do |option| %>
              <option value="<%= option['value'] %>"><%= option['value'] %></option>
            <% end %>
          </select>
        </div>

        <!-- Betroffene Tickets -->
        <div class="p-4 bg-amber-50 border-2 border-amber-200 rounded-lg">
          <div class="flex items-center gap-3">
            <i class="bi bi-exclamation-triangle text-amber-600 text-xl"></i>
            <div>
              <p class="font-bold text-amber-800">
                <%= t('views.organisations.ticket_attribute_definitions.merge_option.affected_tickets', count: @affected_count) %>
              </p>
              <p class="text-sm text-amber-700">
                <% if @affected_count > 0 %>
                  <%= t('views.organisations.ticket_attribute_definitions.merge_option.affected_hint') %>
                <% else %>
                  <%= t('views.organisations.ticket_attribute_definitions.merge_option.none_affected_hint') %>
                <% end %>
              </p>
            </div>
          </div>
        </div>

        <!-- Hinweis Smart Folders -->
        <div class="p-4 bg-blue-50 border-2 border-blue-200 rounded-lg">
          <div class="flex items-center gap-3">
            <i class="bi bi-info-circle text-blue-600 text-xl"></i>
            <div>
              <p class="font-bold text-blue-800"><%= t('views.organisations.ticket_attribute_definitions.merge_option.smart_folders_hint_title') %></p>
              <p class="text-sm text-blue-700">
                <%= t('views.organisations.ticket_attribute_definitions.merge_option.smart_folders_hint_body') %>
              </p>
            </div>
          </div>
        </div>

        <!-- Buttons -->
        <div class="flex justify-between pt-6 border-t border-cream-200">
          <%= render Neo::Buttons::ButtonComponent.new(variant: :secondary,
                url: edit_organisation_project_ticket_attribute_definition_path(@current_organisation, @project, @attribute_definition)) do %>
            <%= t('views.organisations.ticket_attribute_definitions.merge_option.cancel') %>
          <% end %>

          <%= render Neo::Buttons::ButtonComponent.new(variant: :primary, icon: "box-arrow-in-right",
                tag: :button, type: 'submit') do %>
            <%= t('views.organisations.ticket_attribute_definitions.merge_option.submit') %>
          <% end %>
        </div>
      </div>
    <% end %>
  </div>
</div>