<%= @opportunity.new_record? ? "Nuova opportunità" : "Modifica opportunità" %>

<%= form_with model: @opportunity, class: "#{card_class} p-6 space-y-4" do |f| %> <%= render "shared/errors", object: @opportunity %> <%= f.collection_select :organization_id, @organizations, :id, :name, {}, class: input_class %> <%= f.collection_select :project_id, @projects, :id, :name, {}, class: input_class %> <%= f.text_field :name, placeholder: "Nome opportunità", required: true, class: input_class %> <%= f.select :pipeline_stage, Catalog::PIPELINE_STAGES.map { |k,v| [v,k] }, {}, class: input_class %> <%= f.number_field :estimated_value, placeholder: "Valore stimato", step: 0.01, class: input_class %> <%= f.number_field :probability, placeholder: "Probabilità %", min: 0, max: 100, class: input_class %> <%= f.date_field :expected_close_date, class: input_class %> <%= f.select :product, (@products.map(&:name) + %w[Light Full Partnership Evento Altro]).uniq, { include_blank: true }, class: input_class %> <%= f.select :ab_variant, Catalog::AB_VARIANTS.map { |k,v| [v,k] }, { include_blank: true }, class: input_class %> <%= f.select :send_status, Catalog::SEND_STATUSES.map { |k,v| [v,k] }, { include_blank: true }, class: input_class %> <%= f.date_field :sent_on, class: input_class %> <%= f.text_field :outcome, placeholder: "Esito", class: input_class %> <%= f.collection_select :assigned_user_id, @users, :id, :full_name, { include_blank: true }, class: input_class %> <%= f.select :lost_reason, Catalog::LOST_REASONS.map { |k,v| [v,k] }, { include_blank: true }, class: input_class %> <%= f.text_area :notes, rows: 3, class: input_class %>
<%= f.submit class: btn_primary %> <%= link_to "Annulla", @opportunity.persisted? ? @opportunity.organization : opportunities_path, class: btn_secondary %>
<% end %>