Skip to content

Commit

Permalink
Closes #15
Browse files Browse the repository at this point in the history
  • Loading branch information
dngst committed Feb 16, 2024
1 parent 8382227 commit d205324
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions app/models/tenant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ class Tenant < ApplicationRecord

broadcasts_refreshes

def self.unit_types
[
'Studio',
'Bedsitter',
'1 Bedroom',
'2 Bedroom',
'3 Bedroom',
'4 Bedroom',
'5 Bedroom',
'6 Bedroom',
'7 Bedroom',
'8 Bedroom +'
].freeze
end

def self.send_due_date_reminders
tenants_to_remind = where('next_payment <= ?', 5.days.from_now)
tenants_to_remind.find_each do |tenant|
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/registrations/_tenant_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<%= f.label :unit_type, class: "block font-semibold text-gray-800" do %>
Unit type <span class="text-red-500">*</span>
<% end %>
<%= f.text_field :unit_type, placeholder: "3 Bedroom", class: "w-full px-3 py-2 border rounded-lg border-gray-300 mt-2 focus:outline-none focus:border-floston focus:ring-floston" %>
<%= f.select :unit_type, Tenant.unit_types, { prompt: "Select a unit type" }, { class: "w-full px-3 py-2 border rounded-lg border-gray-300 mt-2 focus:outline-none focus:border-floston focus:ring-floston" } %>
<% if f.object.errors.include?(:unit_type) %>
<% f.object.errors.full_messages_for(:unit_type).each do |error| %>
<p class="text-red-500 mt-2"><%= error %></p>
Expand Down

0 comments on commit d205324

Please sign in to comment.