Pipeline

Su cellulare la vedi per stage in verticale. Su desktop resta trascinabile.

<% Catalog::PIPELINE_ORDER.each do |stage| %> <% opportunities = @opportunities_by_stage[stage] %>

<%= Catalog.label_for(Catalog::PIPELINE_STAGES, stage) %>

<%= opportunities.size %> opportunità
<% if opportunities.any? %>
<% opportunities.each do |opp| %> <% next_task = opp.next_pending_task || opp.organization.next_pending_task %>
<%= link_to opp.organization.name, opp.organization, class: "font-medium text-zinc-900 hover:underline dark:text-zinc-50", data: { turbo: false } %>
<%= opp.name %>
<%= format_money(opp.estimated_value) %>
<%= opp.organization.primary_contact&.full_name || opp.organization.contacts.first&.full_name || "—" %>
<%= next_task ? "Next: #{next_task.title}" : "Nessuna next action" %>
Ultima attività: <%= opp.organization.days_since_last_activity ? "#{opp.organization.days_since_last_activity}gg fa" : "—" %>
<%= form_with url: update_stage_opportunity_path(opp), method: :patch, class: "mt-3 space-y-2" do %> <%= select_tag :pipeline_stage, options_for_catalog(Catalog::PIPELINE_STAGES, opp.pipeline_stage), class: input_class, onchange: "this.form.requestSubmit()" %> <% if stage != "lost" %> <%= select_tag :lost_reason, options_for_catalog(Catalog::LOST_REASONS), include_blank: "Motivo se perso", class: input_class %> <% end %> <%= link_to "Apri scheda", opp.organization, class: "#{btn_secondary} w-full" %> <% end %>
<% end %>
<% else %>

Nessuna opportunità in questo stage.

<% end %>
<% end %>