Skip to content

Commit

Permalink
Remove delete button from eventdates that have been billed for
Browse files Browse the repository at this point in the history
Once someone creates a timecard entry for an event date, it cannot
be deleted. This adds text to the event editor to indicate this.
It does not affect the "create a new event" flow.
  • Loading branch information
NoRePercussions committed Nov 13, 2023
1 parent 84de300 commit fcc589c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/views/events/_eventdate_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,14 @@
<% if can? :tic, @event %>
<dl>
<dt>Delete?</dt>
<% if @event.new_record? %>
<dd><%= link_to_remove_fields image_tag("cross.png"), f, true %></dd>
<% if not f.object.timecard_entries.any? %>
<% if @event.new_record? %>
<dd><%= link_to_remove_fields image_tag("cross.png"), f, true %></dd>
<% else %>
<dd><%= link_to_remove_fields image_tag("cross.png"), f %></dd>
<% end %>
<% else %>
<dd><%= link_to_remove_fields image_tag("cross.png"), f %></dd>
<dd>You can't delete this date, as someone has already billed for it.</dd>
<% end %>
</dl>
<% end %>
Expand Down

0 comments on commit fcc589c

Please sign in to comment.