removed label from shift template, added seeds for shift templates
This commit is contained in:
parent
57c8b5b322
commit
66471c2931
14 changed files with 1143 additions and 75 deletions
lib
shift73k/shift_templates
shift73k_web
live
shift_template_live
user_management
templates
|
@ -8,7 +8,6 @@ defmodule Shift73k.ShiftTemplates.ShiftTemplate do
|
|||
@primary_key {:id, :binary_id, autogenerate: true}
|
||||
@foreign_key_type :binary_id
|
||||
schema "shift_templates" do
|
||||
field :label, :string
|
||||
field :subject, :string, default: "My Work Shift"
|
||||
field :description, :string
|
||||
field :location, :string
|
||||
|
@ -26,7 +25,6 @@ defmodule Shift73k.ShiftTemplates.ShiftTemplate do
|
|||
def changeset(shift_template, attrs) do
|
||||
shift_template
|
||||
|> cast(attrs, [
|
||||
:label,
|
||||
:subject,
|
||||
:description,
|
||||
:location,
|
||||
|
|
|
@ -6,10 +6,6 @@
|
|||
phx_change: "validate",
|
||||
phx_submit: "save" %>
|
||||
|
||||
<%= label f, :label %>
|
||||
<%= text_input f, :label %>
|
||||
<%= error_tag f, :label %>
|
||||
|
||||
<%= label f, :subject %>
|
||||
<%= text_input f, :subject %>
|
||||
<%= error_tag f, :subject %>
|
||||
|
|
|
@ -8,48 +8,76 @@
|
|||
<% end %>
|
||||
|
||||
|
||||
<div class="d-flex justify-content-between d-flex align-items-center">
|
||||
<h2>
|
||||
<%= icon_div @socket, "bi-clock-history", [class: "icon baseline"] %>
|
||||
My Shift Templates
|
||||
</h2>
|
||||
<%= live_patch "New Shift Template", to: Routes.shift_template_index_path(@socket, :new), class: "btn btn-primary" %>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Label</th>
|
||||
<th>Subject</th>
|
||||
<th>Description</th>
|
||||
<th>Location</th>
|
||||
<th>Timezone</th>
|
||||
<th>Start time</th>
|
||||
<th>Length</th>
|
||||
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="shift_templates">
|
||||
<%= for shift_template <- @shift_templates do %>
|
||||
<tr id="shift_template-<%= shift_template.id %>">
|
||||
<td><%= shift_template.label %></td>
|
||||
<td><%= shift_template.subject %></td>
|
||||
<td><%= shift_template.description %></td>
|
||||
<td><%= shift_template.location %></td>
|
||||
<td><%= shift_template.timezone %></td>
|
||||
<td><%= shift_template.start_time |> Calendar.strftime("%I:%M %p") %></td>
|
||||
<td><%= shift_template.length_hours %>h <%= shift_template.length_minutes || 0 %>m</td>
|
||||
|
||||
<td>
|
||||
<span><%= live_redirect "Show", to: Routes.shift_template_show_path(@socket, :show, shift_template) %></span>
|
||||
<span><%= live_patch "Edit", to: Routes.shift_template_index_path(@socket, :edit, shift_template) %></span>
|
||||
<span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: shift_template.id, data: [confirm: "Are you sure?"] %></span>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-12 col-lg-10 col-xl-9 ">
|
||||
|
||||
<div class="d-flex justify-content-between d-flex align-items-center mb-3">
|
||||
<h2>
|
||||
<%= icon_div @socket, "bi-clock-history", [class: "icon baseline"] %>
|
||||
My Shift Templates
|
||||
</h2>
|
||||
<%= live_patch "New Shift Template", to: Routes.shift_template_index_path(@socket, :new), class: "btn btn-primary" %>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-sm-10 col-md-9 col-lg-7 col-xl-6 ">
|
||||
|
||||
<%= for shift <- @shift_templates do %>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><%= shift.subject %></h5>
|
||||
<h6 class="card-subtitle mb-2 text-muted"><%= shift.description %></h6>
|
||||
<p class="card-text">huh ok</p>
|
||||
<a href="#" class="card-link">Card link</a>
|
||||
<a href="#" class="card-link">Another link</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Subject</th>
|
||||
<th>Description</th>
|
||||
<th>Location</th>
|
||||
<th>Timezone</th>
|
||||
<th>Start time</th>
|
||||
<th>Length</th>
|
||||
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="shift_templates">
|
||||
<%= for shift <- @shift_templates do %>
|
||||
<tr id="shift_template-<%= shift.id %>">
|
||||
<td><%= shift.subject %></td>
|
||||
<td><%= shift.description %></td>
|
||||
<td><%= shift.location %></td>
|
||||
<td><%= shift.timezone %></td>
|
||||
<td><%= shift.start_time |> Calendar.strftime("%I:%M %p") %></td>
|
||||
<td><%= shift.length_hours %>h <%= shift.length_minutes || 0 %>m</td>
|
||||
|
||||
<td>
|
||||
<span><%= live_redirect "Show", to: Routes.shift_template_show_path(@socket, :show, shift) %></span>
|
||||
<span><%= live_patch "Edit", to: Routes.shift_template_index_path(@socket, :edit, shift) %></span>
|
||||
<span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: shift.id, data: [confirm: "Are you sure?"] %></span>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -11,11 +11,6 @@
|
|||
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<strong>Label:</strong>
|
||||
<%= @shift_template.label %>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<strong>Subject:</strong>
|
||||
<%= @shift_template.subject %>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<%= link "Cancel", to: "#", class: "btn btn-secondary me-2", phx_click: "cancel", phx_target: @myself %>
|
||||
<%= link "Cancel", to: "#", class: "btn me-2", phx_click: "cancel", phx_target: @myself %>
|
||||
<%= link "Confirm Delete", to: "#",
|
||||
class: "btn btn-danger",
|
||||
phx_click: "confirm",
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
<%= link "Cancel", to: "#", class: "btn btn-secondary", phx_click: "cancel", phx_target: @myself %>
|
||||
<%= link "Cancel", to: "#", class: "btn", phx_click: "cancel", phx_target: @myself %>
|
||||
<%= submit "Save",
|
||||
class: "btn btn-primary ",
|
||||
disabled: !@changeset.valid?,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<nav class="navbar navbar-expand-lg navbar-light bg-light mb-4">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-secondary mb-4">
|
||||
<div class="container">
|
||||
|
||||
<h1 class="fs-4 my-0 py-0 lh-base">
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
Aliquam ultrices elit purus, eget dignissim orci pulvinar id. Curabitur tincidunt, ligula eu condimentum porttitor, nibh sapien scelerisque urna, nec cursus nisi nisi a neque. Mauris hendrerit orci blandit, suscipit ante nec, porttitor neque. Nunc.
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn" data-bs-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary">Save changes</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue