Change performer field usage according to the changes in schema.

This commit is contained in:
codevictory
2021-04-24 16:50:47 +03:00
parent be9d128564
commit 4d50936d49
6 changed files with 97 additions and 22 deletions

View File

@@ -7,8 +7,13 @@ defmodule Runosaari.Registration.Performer do
field :email, :string
field :fname, :string
field :lname, :string
field :notes, :string
field :desc, :string
field :tel, :string
field :date1, :boolean, default: false
field :date2, :boolean, default: false
field :date3, :boolean, default: false
field :bus, :boolean, default: false
field :accom, :boolean, default: false
timestamps()
end
@@ -16,8 +21,32 @@ defmodule Runosaari.Registration.Performer do
@doc false
def changeset(performer, attrs) do
performer
|> cast(attrs, [:fname, :lname, :email, :tel, :confirmed, :notes])
|> validate_required([:fname, :lname, :email, :tel, :confirmed, :notes])
|> cast(attrs, [
:fname,
:lname,
:email,
:tel,
:confirmed,
:desc,
:date1,
:date2,
:date3,
:bus,
:accom
])
|> validate_required([
:fname,
:lname,
:email,
:tel,
:confirmed,
:desc,
:date1,
:date2,
:date3,
:bus,
:accom
])
|> unique_constraint(:email)
end
end

View File

@@ -21,9 +21,9 @@
<%= text_input f, :description %>
<%= error_tag f, :description %>
<%= label f, :notes %>
<%= text_input f, :notes %>
<%= error_tag f, :notes %>
<%= label f, :desc %>
<%= text_input f, :desc %>
<%= error_tag f, :desc %>
<div>
<%= submit "Save" %>

View File

@@ -21,7 +21,7 @@
<td><%= performer.email %></td>
<td><%= performer.tel %></td>
<td><%= performer.confirmed %></td>
<td><%= performer.notes %></td>
<td><%= performer.desc %></td>
<td>
<span><%= link "Näytä", to: Routes.performer_path(@conn, :show, performer) %></span>

View File

@@ -21,14 +21,35 @@
<%= text_input form, :tel %>
<%= error_tag form, :tel %>
<%= label form, :notes, "Huomiot" %>
<%= textarea form, :notes %>
<%= error_tag form, :notes %>
<%= label form, :desc, "Huomiot" %>
<%= textarea form, :desc %>
<%= error_tag form, :desc %>
<%= label form, :confirmed, "Vahvitettu" %>
<%= label form, :confirmed, "Vahvistettu" %>
<%= checkbox form, :confirmed %>
<%= error_tag form, :confirmed %>
<h2>Ilmoita alustava kiinnostuksesi tässä</h2>
<%= label form, :date1, "Torstai 22.7" %>
<%= checkbox form, :date1 %>
<%= error_tag form, :date1 %>
<%= label form, :date2, "Perjantai 23.7." %>
<%= checkbox form, :date2 %>
<%= error_tag form, :date2 %>
<%= label form, :date3, "Lauantai 24.7." %>
<%= checkbox form, :date3 %>
<%= error_tag form, :date3 %>
<%= label form, :bus, "olen kiinnostunut bussikuljetuksesta" %>
<%= checkbox form, :bus %>
<%= error_tag form, :bus %>
<%= label form, :accom, "olen kiinnostunut majoituksesta" %>
<%= checkbox form, :accom %>
<%= error_tag form, :accom %>
<div>
<%= submit "Lähetä" %>
</div>

View File

@@ -4,7 +4,7 @@
<%= if performer.confirmed == true do %>
<article>
<h2><%= performer.fname %> <%= performer.lname %></h2>
<p><%= performer.notes %></p>
<p><%= performer.desc %></p>
</article>
<% end %>
<% end %>

View File

@@ -1,38 +1,63 @@
<h1>Show Performer</h1>
<h1>Esiintyjän tiedot</h1>
<ul>
<li>
<strong>Fname:</strong>
<strong>Etunimi:</strong>
<%= @performer.fname %>
</li>
<li>
<strong>Lname:</strong>
<strong>Sukunimi:</strong>
<%= @performer.lname %>
</li>
<li>
<strong>Email:</strong>
<strong>Sähköposti:</strong>
<%= @performer.email %>
</li>
<li>
<strong>Tel:</strong>
<strong>Puhelin numero:</strong>
<%= @performer.tel %>
</li>
<li>
<strong>Confirmed:</strong>
<strong>Vahvistettu:</strong>
<%= @performer.confirmed %>
</li>
<li>
<strong>Notes:</strong>
<%= @performer.notes %>
<strong>Seloste:</strong>
<%= @performer.desc %>
</li>
<li>
<strong>Torstai:</strong>
<%= @performer.date1 %>
</li>
<li>
<strong>Perjantai:</strong>
<%= @performer.date2 %>
</li>
<li>
<strong>Lauantai:</strong>
<%= @performer.date3 %>
</li>
<li>
<strong>Bussikuljetus:</strong>
<%= @performer.bus %>
</li>
<li>
<strong>Majoilus:</strong>
<%= @performer.accom %>
</li>
</ul>
<span><%= link "Edit", to: Routes.admin_performer_path(@conn, :edit, @performer) %></span>
<span><%= link "Back", to: Routes.performer_path(@conn, :index) %></span>
<span><%= link "Muokkaa", to: Routes.admin_performer_path(@conn, :edit, @performer) %></span>
<span><%= link "Takaisin", to: Routes.performer_path(@conn, :index) %></span>