Admin pages.

This commit is contained in:
codevictory
2021-04-22 21:00:55 +03:00
parent b06bae000f
commit cebe145c32
10 changed files with 121 additions and 22 deletions

View File

@@ -9,6 +9,11 @@ defmodule RunosaariWeb.LocationController do
render(conn, "index.html", locations: locations)
end
def admin(conn, _params) do
locations = Area.list_locations()
render(conn, "admin.html", locations: locations)
end
def new(conn, _params) do
changeset = Area.change_location(%Location{})
render(conn, "new.html", changeset: changeset)

View File

@@ -9,6 +9,11 @@ defmodule RunosaariWeb.PerformanceController do
render(conn, "index.html", performances: performances)
end
def admin(conn, _params) do
performances = Schedule.list_performances()
render(conn, "admin.html", performances: performances)
end
def new(conn, _params) do
changeset = Schedule.change_performance(%Performance{})
render(conn, "new.html", changeset: changeset)

View File

@@ -9,6 +9,11 @@ defmodule RunosaariWeb.PerformerController do
render(conn, "index.html", performers: performers)
end
def admin(conn, _params) do
performers = Registration.list_performers()
render(conn, "admin.html", performers: performers)
end
def new(conn, _params) do
changeset = Registration.change_performer(%Performer{})
render(conn, "new.html", changeset: changeset)

View File

@@ -25,6 +25,9 @@ defmodule RunosaariWeb.Router do
scope "/admin", RunosaariWeb, as: :admin do
pipe_through :browser
get "/performers", PerformerController, :admin
get "/performers", PerformanceController, :admin
get "/performers", LocationController, :admin
resources "/performers", PerformerController, except: [:index, :show]
resources "/performances", PerformanceController, except: [:index, :show]
resources "/locations", LocationController, except: [:index, :show]

View File

@@ -0,0 +1,34 @@
<h1>Tapahtumapaikat - HALLINTA</h1>
<table>
<thead>
<tr>
<th>Name</th>
<th>Address</th>
<th>Reserved seats</th>
<th>Max seats</th>
<th>Description</th>
<th></th>
</tr>
</thead>
<tbody>
<%= for location <- @locations do %>
<tr>
<td><%= location.name %></td>
<td><%= location.address %></td>
<td><%= location.reserved_seats %></td>
<td><%= location.max_seats %></td>
<td><%= location.description %></td>
<td>
<span><%= link "Show", to: Routes.location_path(@conn, :show, location) %></span>
<span><%= link "Edit", to: Routes.admin_location_path(@conn, :edit, location) %></span>
<span><%= link "Delete", to: Routes.admin_location_path(@conn, :delete, location), method: :delete, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= link "New Location", to: Routes.admin_location_path(@conn, :new) %></span>

View File

@@ -20,15 +20,9 @@
<td><%= location.reserved_seats %></td>
<td><%= location.max_seats %></td>
<td><%= location.description %></td>
<td>
<span><%= link "Show", to: Routes.location_path(@conn, :show, location) %></span>
<span><%= link "Edit", to: Routes.admin_location_path(@conn, :edit, location) %></span>
<span><%= link "Delete", to: Routes.admin_location_path(@conn, :delete, location), method: :delete, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= link "New Location", to: Routes.admin_location_path(@conn, :new) %></span>
<span><%= link "Hallinta", to: Routes.admin_location_path(@conn, :admin) %></span>

View File

@@ -0,0 +1,30 @@
<h1>Ohjelma - HALLINTA</h1>
<table>
<thead>
<tr>
<th>Time</th>
<th>Description</th>
<th>Notes</th>
<th></th>
</tr>
</thead>
<tbody>
<%= for performance <- @performances do %>
<tr>
<td><%= performance.time %></td>
<td><%= performance.description %></td>
<td><%= performance.notes %></td>
<td>
<span><%= link "Show", to: Routes.performance_path(@conn, :show, performance) %></span>
<span><%= link "Edit", to: Routes.admin_performance_path(@conn, :edit, performance) %></span>
<span><%= link "Delete", to: Routes.admin_performance_path(@conn, :delete, performance), method: :delete, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= link "New Performance", to: Routes.admin_performance_path(@conn, :new) %></span>

View File

@@ -16,15 +16,9 @@
<td><%= performance.time %></td>
<td><%= performance.description %></td>
<td><%= performance.notes %></td>
<td>
<span><%= link "Show", to: Routes.performance_path(@conn, :show, performance) %></span>
<span><%= link "Edit", to: Routes.admin_performance_path(@conn, :edit, performance) %></span>
<span><%= link "Delete", to: Routes.admin_performance_path(@conn, :delete, performance), method: :delete, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= link "New Performance", to: Routes.admin_performance_path(@conn, :new) %></span>
<span><%= link "Hallinta", to: Routes.admin_performance_path(@conn, :admin) %></span>

View File

@@ -0,0 +1,36 @@
<h1>Esiintyjät - HALLINTA</h1>
<table>
<thead>
<tr>
<th>Fname</th>
<th>Lname</th>
<th>Email</th>
<th>Tel</th>
<th>Confirmed</th>
<th>Notes</th>
<th></th>
</tr>
</thead>
<tbody>
<%= for performer <- @performers do %>
<tr>
<td><%= performer.fname %></td>
<td><%= performer.lname %></td>
<td><%= performer.email %></td>
<td><%= performer.tel %></td>
<td><%= performer.confirmed %></td>
<td><%= performer.notes %></td>
<td>
<span><%= link "Show", to: Routes.performer_path(@conn, :show, performer) %></span>
<span><%= link "Edit", to: Routes.admin_performer_path(@conn, :edit, performer) %></span>
<span><%= link "Delete", to: Routes.admin_performer_path(@conn, :delete, performer), method: :delete, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= link "New Performance", to: Routes.admin_performance_path(@conn, :new) %></span>

View File

@@ -22,15 +22,8 @@
<td><%= performer.tel %></td>
<td><%= performer.confirmed %></td>
<td><%= performer.notes %></td>
<td>
<span><%= link "Show", to: Routes.performer_path(@conn, :show, performer) %></span>
<span><%= link "Edit", to: Routes.admin_performer_path(@conn, :edit, performer) %></span>
<span><%= link "Delete", to: Routes.admin_performer_path(@conn, :delete, performer), method: :delete, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<% end %>
</tbody>
</table>
<span><%= link "New Performance", to: Routes.admin_performance_path(@conn, :new) %></span>
<%= link "Hallinta", to: Routes.admin_performer_path(@conn, :admin) %>