aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/events/_form.html.erb
blob: dbce3b1a4ad00d78b20399d1e4164b2bc7763c71 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<hr>
<h3>Create a new event</h3>

<ul class="nav nav-tabs" id="myTab" role="tablist">
  <li class="nav-item" role="presentation">
    <button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button" role="tab" aria-controls="home" aria-selected="true">Inspection</button>
  </li>
  <li class="nav-item" role="presentation">
    <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="false">Meeting</button>
  </li>
  <li class="nav-item" role="presentation">
    <button class="nav-link" id="contact-tab" data-bs-toggle="tab" data-bs-target="#contact" type="button" role="tab" aria-controls="contact" aria-selected="false">Other</button>
  </li>
</ul>
<div class="tab-content" id="myTabContent">
  <div class="tab-pane active mt-2" id="home" role="tabpanel" aria-labelledby="home-tab">
    <%= form_with(model: event) do |form| %>
      <% if event.errors.any? %>
        <div style="color: red">
          <h2><%= pluralize(event.errors.count, "error") %> prohibited this event from being saved:</h2>

          <ul>
            <% event.errors.each do |error| %>
              <li><%= error.full_message %></li>
            <% end %>
          </ul>
        </div>
      <% end %>

      <div>
        <%= form.label :date, style: "display: block" %>
        <%= form.date_field :date %>
      </div>

      <div>
        <%= form.label "Event name", style: "display: block" %>
        <%= form.text_field :name %>
      </div>
      
      <div>
        <%= form.label "Organisation", style: "display: block" %>
        <%= form.select :organisation_id, Organisation.all.collect { |o| [ o.name, o.id ] }, include_blank: true %>
      </div>

      <div>
        <%= form.submit style: "background: green; color: white; margin-top: 1.1em;"%>
      </div>
    <% end %>
  </div>
  <div class="tab-pane mt-2" id="profile" role="tabpanel" aria-labelledby="profile-tab">
    <%= form_with(model: event) do |form| %>
      <% if event.errors.any? %>
        <div style="color: red">
          <h2><%= pluralize(event.errors.count, "error") %> prohibited this event from being saved:</h2>

          <ul>
            <% event.errors.each do |error| %>
              <li><%= error.full_message %></li>
            <% end %>
          </ul>
        </div>
      <% end %>

      <div>
        <%= form.label :date, style: "display: block" %>
        <%= form.date_field :date %>
      </div>

      <div>
        <%= form.label "Event name", style: "display: block" %>
        <%= form.text_field :name %>
      </div>

      <div>
        <%= form.submit style: "background: green; color: white; margin-top: 1.1em;"%>
      </div>
    <% end %>

  </div>
  <div class="tab-pane mt-2" id="contact" role="tabpanel" aria-labelledby="contact-tab">
    <%= form_with(model: event) do |form| %>
      <% if event.errors.any? %>
        <div style="color: red">
          <h2><%= pluralize(event.errors.count, "error") %> prohibited this event from being saved:</h2>

          <ul>
            <% event.errors.each do |error| %>
              <li><%= error.full_message %></li>
            <% end %>
          </ul>
        </div>
      <% end %>

      <div>
        <%= form.label :date, style: "display: block" %>
        <%= form.date_field :date %>
      </div>

      <div>
        <%= form.label "Event name", style: "display: block" %>
        <%= form.text_field :name %>
      </div>

      <div>
        <%= form.submit style: "background: green; color: white; margin-top: 1.1em;"%>
      </div>
    <% end %>
  </div>
</div>

<hr>