diff --git a/app/controllers/admin/payment_settings_controller.rb b/app/controllers/admin/payment_settings_controller.rb
new file mode 100644
index 0000000..e2f0361
--- /dev/null
+++ b/app/controllers/admin/payment_settings_controller.rb
@@ -0,0 +1,28 @@
+class Admin::PaymentSettingsController < Admin::BaseController
+
+ layout 'admin'
+
+ def index
+ @payment_settings = PaymentSetting.all
+ end
+
+ def edit
+ @payment_setting = PaymentSetting.find(params[:id])
+ end
+
+ def update
+ @payment_setting = PaymentSetting.find(params[:id])
+ if @payment_setting.update(payment_setting_params)
+ redirect_to admin_payment_settings_path, notice: 'Payment setting updated successfully.'
+ else
+ render :edit
+ end
+ end
+
+ private
+
+ def payment_setting_params
+ params.require(:payment_setting).permit(:key, :value)
+ end
+end
+
\ No newline at end of file
diff --git a/app/controllers/bookings_controller.rb b/app/controllers/bookings_controller.rb
index fed71c6..e3efca1 100644
--- a/app/controllers/bookings_controller.rb
+++ b/app/controllers/bookings_controller.rb
@@ -1,8 +1,7 @@
class BookingsController < ApplicationController
before_action :authenticate_user!
- before_action :set_venue, except: [:index, :new, :create]
+ before_action :set_venue, only: [:new, :create, :index]
before_action :set_booking, only: [:edit, :update, :destroy]
- before_action :set_venues, only: [:new, :edit]
layout 'admin', if: -> { current_user.admin? }
@@ -10,23 +9,29 @@ def index
@bookings = if @venue
@venue.bookings.order(:booking_date)
else
- Booking.includes(:venue, :user).order(:booking_date)
+ Booking.includes(:venue, :user).order(:booking_date) if current_user.admin?
end
end
def new
- @booking = Booking.new
- @venues = Venue.all
- @booked_dates = Booking.where(venue_id: params[:venue_id]).pluck(:booking_date).map(&:to_s)
- end
-
+ @booking = Booking.new
+ end
def create
@booking = Booking.new(booking_params)
+ @booking.venue = @venue
+ @booking.user = current_user
+
if @booking.save
- redirect_to all_bookings_path, notice: 'Booking was successfully created.'
+ # Initiate the payment via Flutterwave
+ result = FlutterwavePaymentService.new(@booking).initiate_payment
+ if result[:success]
+ redirect_to result[:payment_link], allow_other_host: true
+ else
+ flash[:error] = "Payment initialization failed: #{result[:error]}"
+ redirect_to @venue
+ end
else
- set_venues
render :new
end
end
@@ -37,7 +42,6 @@ def update
if @booking.update(booking_params)
redirect_to all_bookings_path, notice: 'Booking was successfully updated.'
else
- set_venues
render :edit
end
end
@@ -46,23 +50,38 @@ def destroy
@booking.destroy
redirect_to all_bookings_path, notice: 'Booking was successfully deleted.'
end
+
+ def payment_success
+ transaction_id = params[:transaction_id]
+
+ response = HTTParty.get(
+ "https://api.flutterwave.com/v3/transactions/#{transaction_id}/verify",
+ headers: {
+ "Authorization" => "Bearer #{@api_key}"
+ }
+ )
+
+ if response['status'] == 'success'
+ @booking.update(status: 'Confirmed')
+ redirect_to @booking, notice: 'Payment was successful. Booking confirmed.'
+ else
+ flash[:error] = "Payment verification failed. Please contact support."
+ redirect_to @booking
+ end
+ end
private
- def set_venues
- @venues = Venue.all
+ def set_venue
+ @venue = Venue.find_by(id: params[:venue_id])
end
def set_booking
@booking = Booking.find(params[:id])
end
- def set_venues
- @venues = Venue.all
- end
-
def booking_params
params.require(:booking).permit(:booking_date, :user_id, :venue_id)
end
- end
+end
\ No newline at end of file
diff --git a/app/controllers/memberships_controller.rb b/app/controllers/memberships_controller.rb
index 87617ca..fcd2535 100644
--- a/app/controllers/memberships_controller.rb
+++ b/app/controllers/memberships_controller.rb
@@ -4,7 +4,8 @@ class MembershipsController < ApplicationController
before_action :set_membership, only: [:show, :edit, :update, :destroy, :flutterwave_payment, :payment_success, :payment_cancel]
before_action :authorize_user!, only: [:edit, :update, :destroy]
- layout 'admin', if: -> { current_user.admin? }
+ # Apply the layout based on the user role
+ layout :determine_layout
def index
@memberships = current_user.admin? ? Membership.all : current_user.memberships
@@ -95,9 +96,15 @@ def set_membership
def membership_params
permitted_params = [
- :first_name, :last_name, :phone, :email, :partner_first_name,
- :partner_last_name, :partner_phone, :partner_email, :pastor_name,
- :partner_pastor_name, :ministry, :partner_ministry, :lab_results
+ :first_name, :last_name, :phone, :email,
+ :partner_first_name, :partner_last_name, :partner_phone, :partner_email,
+ :male_birth_date, :female_birth_date,
+ :male_place_of_birth, :female_place_of_birth,
+ :male_residential_address, :female_residential_address,
+ :male_born_again, :female_born_again,
+ :male_born_again_date, :female_born_again_date,
+ :male_born_again_reason, :female_born_again_reason,
+ :male_passport_picture, :female_passport_picture
]
permitted_params << :status if current_user.admin?
@@ -110,5 +117,10 @@ def authorize_user!
redirect_to memberships_path, alert: 'You are not authorized to perform this action.'
end
end
+
+ # Determines which layout to use based on the user's role
+ def determine_layout
+ current_user.admin? ? 'admin' : 'application'
+ end
end
\ No newline at end of file
diff --git a/app/controllers/venues_controller.rb b/app/controllers/venues_controller.rb
index 06d649d..a5c99ef 100644
--- a/app/controllers/venues_controller.rb
+++ b/app/controllers/venues_controller.rb
@@ -3,7 +3,7 @@ class VenuesController < ApplicationController
before_action :set_venue, only: [:show, :edit, :update, :destroy]
layout 'admin', if: -> { current_user.admin? }
-
+
def index
@venues = Venue.all
end
@@ -48,7 +48,7 @@ def set_venue
end
def venue_params
- params.require(:venue).permit(:name, :location_id)
+ params.require(:venue).permit(:name, :location_id, :price)
end
end
\ No newline at end of file
diff --git a/app/helpers/admin/payment_settings_helper.rb b/app/helpers/admin/payment_settings_helper.rb
new file mode 100644
index 0000000..dd82674
--- /dev/null
+++ b/app/helpers/admin/payment_settings_helper.rb
@@ -0,0 +1,2 @@
+module Admin::PaymentSettingsHelper
+end
diff --git a/app/models/payment_setting.rb b/app/models/payment_setting.rb
new file mode 100644
index 0000000..cd00c9d
--- /dev/null
+++ b/app/models/payment_setting.rb
@@ -0,0 +1,5 @@
+# app/models/payment_setting.rb
+class PaymentSetting < ApplicationRecord
+ validates :key, presence: true, uniqueness: true
+ validates :value, presence: true
+end
diff --git a/app/models/venue.rb b/app/models/venue.rb
index e98357a..210616a 100644
--- a/app/models/venue.rb
+++ b/app/models/venue.rb
@@ -4,4 +4,5 @@ class Venue < ApplicationRecord
validates :name, presence: true
validates :location, presence: true
+ validates :price, presence: true, numericality: { greater_than_or_equal_to: 0 }
end
diff --git a/app/services/flutterwave_payment_service.rb b/app/services/flutterwave_payment_service.rb
index fb1a2fe..912f82e 100644
--- a/app/services/flutterwave_payment_service.rb
+++ b/app/services/flutterwave_payment_service.rb
@@ -1,26 +1,27 @@
# app/services/flutterwave_payment_service.rb
class FlutterwavePaymentService
- def initialize(membership)
- @membership = membership
+ def initialize(booking)
+ @booking = booking
+ @venue = booking.venue
@api_key = "FLWSECK_TEST-5888bc2d2331e6137f56fb83be4484f7-X" # Replace with your actual secret key
end
def initiate_payment
payment_data = {
tx_ref: SecureRandom.hex(10), # Unique transaction reference
- amount: 100.0, # Replace with your desired amount logic
+ amount: @venue.price, # Use the venue's price as the amount
currency: 'GHS',
redirect_url: payment_success_url,
payment_options: 'card, mobilemoneyghana',
customer: {
- email: @membership.email,
- phonenumber: @membership.phone,
- name: "#{@membership.first_name} #{@membership.last_name}"
+ email: @booking.user.email,
+ phonenumber: @booking.user.phone, # Assuming user model has a phone attribute
+ name: @booking.user.full_name # Assuming user model has a full_name method
},
customizations: {
- title: 'Membership Registration Payment',
- description: 'Payment for membership registration',
- logo: 'https://yourwebsite.com/logo.png' # Replace with your logo URL
+ title: 'Venue Booking Payment',
+ description: "Payment for booking at #{@venue.name}",
+ logo: 'https://flcms-99e59f7f5d8a.herokuapp.com/assets/logo-img-1-5be75ec22e5c2c62cb5e1d2161924c07fae0db0619b6c635d0d0d40b04d5b05c.png' # Replace with your logo URL
}
}
@@ -43,7 +44,7 @@ def initiate_payment
private
def payment_success_url
- Rails.application.routes.url_helpers.payment_success_membership_url(@membership, host: Rails.application.config.action_mailer.default_url_options[:host])
+ Rails.application.routes.url_helpers.payment_success_booking_url(@booking, host: Rails.application.config.action_mailer.default_url_options[:host])
end
-end
+ end
\ No newline at end of file
diff --git a/app/views/admin/payment_settings/edit.html.erb b/app/views/admin/payment_settings/edit.html.erb
new file mode 100644
index 0000000..0036d89
--- /dev/null
+++ b/app/views/admin/payment_settings/edit.html.erb
@@ -0,0 +1,13 @@
+
+
Payment Settings
+
+<%= form_with(model: @payment_setting, url: admin_payment_setting_path, local: true) do |form| %>
+
+ <%= form.label :value, "Membership Registration Fee (GHC)" %>
+ <%= form.text_field :value, class: "form-control" %>
+
+
+
+ <%= form.submit "Update Settings", class: "btn btn-primary" %>
+
+<% end %>
diff --git a/app/views/admin/payment_settings/index.html.erb b/app/views/admin/payment_settings/index.html.erb
new file mode 100644
index 0000000..2c4e43a
--- /dev/null
+++ b/app/views/admin/payment_settings/index.html.erb
@@ -0,0 +1,29 @@
+
+Payment Settings
+
+<% if @payment_settings.present? %>
+
+
+
+ Key
+ Value
+ Actions
+
+
+
+ <% @payment_settings.each do |setting| %>
+
+ <%= setting.key %>
+ <%= setting.value %>
+
+ <%= link_to 'Edit', edit_admin_payment_setting_path(setting), class: 'btn btn-secondary btn-sm' %>
+
+
+ <% end %>
+
+
+<% else %>
+ No payment settings found.
+<% end %>
+
+<%= link_to 'Back', admin_root_path, class: 'btn btn-secondary mt-3' %>
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb
index fdceb7b..cab5aca 100644
--- a/app/views/layouts/admin.html.erb
+++ b/app/views/layouts/admin.html.erb
@@ -80,12 +80,12 @@
- New project...
- Settings
+ <%= link_to "Settings", admin_payment_settings_path, class: "dropdown-item" %>
Profile
<%= link_to "Sign out", destroy_user_session_path, method: :delete, class: "dropdown-item" %>
+
<% end %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 1abc5fa..71c110a 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -1,22 +1,59 @@
-
-
-
-
-
-
- FLMS
- <%= csrf_meta_tags %>
- <%= csp_meta_tag %>
-
-
-
- <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
- <%= javascript_importmap_tags %>
-
-
-
-
- <%= yield %>
-
+
+
+
+
+
+
+ FLMS
+ <%= csrf_meta_tags %>
+ <%= csp_meta_tag %>
+
+
+
+ <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
+
+
+
+
+
+
+
+ <%= javascript_importmap_tags %>
+
+
+
+
+
+
+ <% if user_signed_in? && current_user.user? %>
+
+
+
+
FLMS
+
+
+
+
+
+
+ <%= link_to 'Home', home_path, class: 'nav-link' %>
+
+
+ <%= link_to 'Register Membership', new_membership_path, class: 'nav-link' %>
+
+
+
+
+ <%= link_to 'Sign out', destroy_user_session_path, method: :delete, class: 'nav-link' %>
+
+
+
+
+
+ <% end %>
+
+ <%= yield %>
+
+
diff --git a/app/views/memberships/_form.html.erb b/app/views/memberships/_form.html.erb
index eb80ebe..ac3c112 100644
--- a/app/views/memberships/_form.html.erb
+++ b/app/views/memberships/_form.html.erb
@@ -11,82 +11,109 @@
<% end %>
+
- <%= form.label :first_name, class: "form-label" %>
- <%= form.text_field :first_name, class: "form-control" %>
+ <%= form.label :first_name, "Name (Male)", class: "form-label" %> *
+ <%= form.text_field :first_name, class: "form-control", required: true %>
- <%= form.label :last_name, class: "form-label" %>
- <%= form.text_field :last_name, class: "form-control" %>
+ <%= form.label :email, "Email Address (Male)", class: "form-label" %> *
+ <%= form.email_field :email, class: "form-control", required: true %>
- <%= form.label :phone, class: "form-label" %>
- <%= form.text_field :phone, class: "form-control" %>
+ <%= form.label :male_birth_date, "Date of Birth (Male)", class: "form-label" %> *
+ <%= form.date_field :male_birth_date, class: "form-control", required: true %>
- <%= form.label :email, class: "form-label" %>
- <%= form.email_field :email, class: "form-control" %>
+ <%= form.label :phone, "Phone Number (Whatsapp) Male", class: "form-label" %> *
+ <%= form.text_field :phone, class: "form-control", required: true %>
- <%= form.label :partner_first_name, "Partner's First Name", class: "form-label" %>
- <%= form.text_field :partner_first_name, class: "form-control" %>
+ <%= form.label :male_place_of_birth, "Place of Birth (Male)", class: "form-label" %> *
+ <%= form.text_field :male_place_of_birth, class: "form-control", required: true %>
- <%= form.label :partner_last_name, "Partner's Last Name", class: "form-label" %>
- <%= form.text_field :partner_last_name, class: "form-control" %>
+ <%= form.label :male_residential_address, "Residential Address (Male)", class: "form-label" %> *
+ <%= form.text_field :male_residential_address, class: "form-control", required: true %>
- <%= form.label :partner_phone, "Partner's Phone Number", class: "form-label" %>
- <%= form.text_field :partner_phone, class: "form-control" %>
+ <%= form.label :male_born_again, "Are You Born Again (Male)", class: "form-label" %> *
+ <%= form.select :male_born_again, [['Yes', 'Yes'], ['No', 'No']], { prompt: 'Select an Option' }, class: "form-control", required: true %>
- <%= form.label :partner_email, "Partner's Email Address", class: "form-label" %>
- <%= form.email_field :partner_email, class: "form-control" %>
+ <%= form.label :male_born_again_date, "If Yes, when? (Male)", class: "form-label" %>
+ <%= form.text_field :male_born_again_date, class: "form-control" %>
+
+
+
+ <%= form.label :male_born_again_reason, "If No, why? (Male). Type N/A if this does not apply.", class: "form-label" %> *
+ <%= form.text_area :male_born_again_reason, class: "form-control", required: true %>
- <%= form.label :pastor_name, "Pastor's Name", class: "form-label" %>
- <%= form.text_field :pastor_name, class: "form-control" %>
+ <%= form.label :male_passport_picture, "Passport Picture (Male)", class: "form-label" %> *
+ <%= form.file_field :male_passport_picture, class: "form-control", required: true %>
+
- <%= form.label :partner_pastor_name, "Partner's Pastor Name", class: "form-label" %>
- <%= form.text_field :partner_pastor_name, class: "form-control" %>
+ <%= form.label :partner_first_name, "Name (Female)", class: "form-label" %> *
+ <%= form.text_field :partner_first_name, class: "form-control", required: true %>
- <%= form.label :ministry, class: "form-label" %>
- <%= form.text_field :ministry, class: "form-control" %>
+ <%= form.label :partner_email, "Email Address (Female)", class: "form-label" %> *
+ <%= form.email_field :partner_email, class: "form-control", required: true %>
- <%= form.label :partner_ministry, "Partner's Ministry", class: "form-label" %>
- <%= form.text_field :partner_ministry, class: "form-control" %>
+ <%= form.label :female_birth_date, "Date of Birth (Female)", class: "form-label" %> *
+ <%= form.date_field :female_birth_date, class: "form-control", required: true %>
-
- <%= form.label :lab_results, "Upload Lab Results", class: "form-label" %>
- <%= form.file_field :lab_results, class: "form-control" %>
-
-
- <% if current_user.admin? %>
-
- <%= form.label :status, class: "form-label" %>
-
- Select status
- >Pending
- >Confirmed
-
-
- <% end %>
+
+ <%= form.label :partner_phone, "Phone Number (Whatsapp) Female", class: "form-label" %> *
+ <%= form.text_field :partner_phone, class: "form-control", required: true %>
+
+
+
+ <%= form.label :female_place_of_birth, "Place of Birth (Female)", class: "form-label" %> *
+ <%= form.text_field :female_place_of_birth, class: "form-control", required: true %>
+
+
+
+ <%= form.label :female_residential_address, "Residential Address (Female)", class: "form-label" %> *
+ <%= form.text_field :female_residential_address, class: "form-control", required: true %>
+
+
+
+ <%= form.label :female_born_again, "Are You Born Again (Female)", class: "form-label" %> *
+ <%= form.select :female_born_again, [['Yes', 'Yes'], ['No', 'No']], { prompt: 'Select an Option' }, class: "form-control", required: true %>
+
+
+
+ <%= form.label :female_born_again_date, "If Yes, when? (Female)", class: "form-label" %>
+ <%= form.text_field :female_born_again_date, class: "form-control" %>
+
+
+
+ <%= form.label :female_born_again_reason, "If No, why? (Female). Type N/A if this does not apply.", class: "form-label" %> *
+ <%= form.text_area :female_born_again_reason, class: "form-control", required: true %>
+
+
+
+ <%= form.label :female_passport_picture, "Passport Picture (Female)", class: "form-label" %> *
+ <%= form.file_field :female_passport_picture, class: "form-control", required: true %>
+
+
<% if current_user.admin? %>
<%= form.submit "Submit", class: "btn btn-primary" %>
diff --git a/app/views/memberships/edit.html.erb b/app/views/memberships/edit.html.erb
index c8af1a2..1c24449 100644
--- a/app/views/memberships/edit.html.erb
+++ b/app/views/memberships/edit.html.erb
@@ -1,6 +1,13 @@
-
-
Edit Membership
+
+
Payment Settings
-<%= render 'form', membership: @membership %>
+<%= form_with(model: [:admin, @payment_setting], local: true) do |form| %>
+
+ <%= form.label :value, "Membership Registration Fee (GHC)" %>
+ <%= form.text_field :value, class: "form-control" %>
+
-<%= link_to 'Back', memberships_path, class: 'btn btn-secondary mt-3' %>
+ <%= form.submit "Update Payment Setting", class: "btn btn-primary" %>
+<% end %>
+
+<%= link_to 'Back', admin_root_path, class: 'btn btn-secondary mt-3' %>
diff --git a/app/views/memberships/new.html.erb b/app/views/memberships/new.html.erb
index 022ddf9..8b4443d 100644
--- a/app/views/memberships/new.html.erb
+++ b/app/views/memberships/new.html.erb
@@ -1,6 +1,41 @@
New Membership Registration
+
+<% unless current_user.admin? %>
+
+
+
+
+
+
This Form Is Required To Be Filled Out Fully As Part Of Your Application To Be Counselled By The First Love Marriage School.
+
To Complete This Form, The Following Will Be Required:
+
+ A Scanned Copy Of A Passport Picture On A White Background
+ A Scanned Copy Of Your Required Medical (We Only Recommend That You Do The Suggested Tests And Share them With Us)
+ Payment Of GHC 500.00 For The Couple
+ A Bible
+ A Copy Of The Model Marriage Book By Bishop Dag Heward-Mills
+
+
+
+
+
+
+
+
+<% end %>
+
<%= render 'form', membership: @membership %>
<%= link_to 'Back', memberships_path, class: 'btn btn-secondary mt-3' %>
diff --git a/app/views/venues/_form.html.erb b/app/views/venues/_form.html.erb
index c7e8be3..6c08a0a 100644
--- a/app/views/venues/_form.html.erb
+++ b/app/views/venues/_form.html.erb
@@ -20,6 +20,11 @@
<%= form.collection_select :location_id, Location.all, :id, :name, { prompt: "Select Location" }, { class: "form-control" } %>
+
+ <%= form.label :price, "Price (GHC)" %>
+ <%= form.text_field :price, class: "form-control" %>
+
+
<%= form.submit class: "btn btn-primary" %>
diff --git a/app/views/venues/index.html.erb b/app/views/venues/index.html.erb
index 31ba809..957a968 100644
--- a/app/views/venues/index.html.erb
+++ b/app/views/venues/index.html.erb
@@ -9,6 +9,7 @@
Name
Location
+ Price (GHC)
<% if current_user.admin? %>
Actions
<% end %>
@@ -19,6 +20,7 @@
<%= link_to venue.name, venue_path(venue) %>
<%= venue.location.name %>
+ <%= number_to_currency(venue.price, unit: "GHC ") %>
<% if current_user.admin? %>
<%= link_to 'Edit', edit_venue_path(venue), class: 'btn btn-secondary' %>
diff --git a/app/views/venues/show.html.erb b/app/views/venues/show.html.erb
index 40ec94d..4649298 100644
--- a/app/views/venues/show.html.erb
+++ b/app/views/venues/show.html.erb
@@ -1,6 +1,7 @@
<%= @venue.name %> - Details
Location: <%= @venue.location.name %>
+Price: <%= number_to_currency(@venue.price, unit: "GHC ") %>
Bookings
diff --git a/config/routes.rb b/config/routes.rb
index 6c23dfa..9343290 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -13,7 +13,11 @@
# Routes for venues and nested bookings
resources :venues do
- resources :bookings, only: [:index, :new, :create, :edit, :update, :destroy]
+ resources :bookings do
+ member do
+ get 'payment_success', to: 'bookings#payment_success'
+ end
+ end
end
# Route for fetching available dates for a location
@@ -42,6 +46,9 @@
resources :users
resources :locations, only: [:destroy]
resources :venues, only: [:destroy]
+
+ # Singleton resource for payment settings
+ resources :payment_settings, only: [:index, :edit, :update]
end
# Ensure the admin login path works as well
diff --git a/db/migrate/20240819211451_add_details_to_memberships.rb b/db/migrate/20240819211451_add_details_to_memberships.rb
new file mode 100644
index 0000000..4e530fa
--- /dev/null
+++ b/db/migrate/20240819211451_add_details_to_memberships.rb
@@ -0,0 +1,18 @@
+class AddDetailsToMemberships < ActiveRecord::Migration[7.2]
+ def change
+ add_column :memberships, :male_birth_date, :date
+ add_column :memberships, :female_birth_date, :date
+ add_column :memberships, :male_place_of_birth, :string
+ add_column :memberships, :female_place_of_birth, :string
+ add_column :memberships, :male_residential_address, :string
+ add_column :memberships, :female_residential_address, :string
+ add_column :memberships, :male_born_again, :string
+ add_column :memberships, :female_born_again, :string
+ add_column :memberships, :male_born_again_date, :string
+ add_column :memberships, :female_born_again_date, :string
+ add_column :memberships, :male_born_again_reason, :text
+ add_column :memberships, :female_born_again_reason, :text
+ add_column :memberships, :male_passport_picture, :string
+ add_column :memberships, :female_passport_picture, :string
+ end
+end
diff --git a/db/migrate/20240819211906_create_payment_settings.rb b/db/migrate/20240819211906_create_payment_settings.rb
new file mode 100644
index 0000000..2c83b1e
--- /dev/null
+++ b/db/migrate/20240819211906_create_payment_settings.rb
@@ -0,0 +1,10 @@
+class CreatePaymentSettings < ActiveRecord::Migration[7.2]
+ def change
+ create_table :payment_settings do |t|
+ t.string :key
+ t.string :value
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20240819215422_add_price_to_venues.rb b/db/migrate/20240819215422_add_price_to_venues.rb
new file mode 100644
index 0000000..94ec3c1
--- /dev/null
+++ b/db/migrate/20240819215422_add_price_to_venues.rb
@@ -0,0 +1,5 @@
+class AddPriceToVenues < ActiveRecord::Migration[7.2]
+ def change
+ add_column :venues, :price, :decimal, precision: 10, scale: 2
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 5614829..0be4be5 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[7.2].define(version: 2024_08_18_211802) do
+ActiveRecord::Schema[7.2].define(version: 2024_08_19_215422) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -89,9 +89,30 @@
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "status", default: "Pending"
+ t.date "male_birth_date"
+ t.date "female_birth_date"
+ t.string "male_place_of_birth"
+ t.string "female_place_of_birth"
+ t.string "male_residential_address"
+ t.string "female_residential_address"
+ t.string "male_born_again"
+ t.string "female_born_again"
+ t.string "male_born_again_date"
+ t.string "female_born_again_date"
+ t.text "male_born_again_reason"
+ t.text "female_born_again_reason"
+ t.string "male_passport_picture"
+ t.string "female_passport_picture"
t.index ["user_id"], name: "index_memberships_on_user_id"
end
+ create_table "payment_settings", force: :cascade do |t|
+ t.string "key"
+ t.string "value"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
@@ -110,6 +131,7 @@
t.bigint "location_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.decimal "price", precision: 10, scale: 2
t.index ["location_id"], name: "index_venues_on_location_id"
end
diff --git a/db/seeds.rb b/db/seeds.rb
index 4fbd6ed..38ae408 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -7,3 +7,5 @@
# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
# MovieGenre.find_or_create_by!(name: genre_name)
# end
+# db/seeds.rb
+PaymentSetting.create!(key: "membership_fee", value: "500.00")
diff --git a/test/controllers/admin/payment_settings_controller_test.rb b/test/controllers/admin/payment_settings_controller_test.rb
new file mode 100644
index 0000000..87aea8e
--- /dev/null
+++ b/test/controllers/admin/payment_settings_controller_test.rb
@@ -0,0 +1,7 @@
+require "test_helper"
+
+class Admin::PaymentSettingsControllerTest < ActionDispatch::IntegrationTest
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/fixtures/payment_settings.yml b/test/fixtures/payment_settings.yml
new file mode 100644
index 0000000..fcfc1e8
--- /dev/null
+++ b/test/fixtures/payment_settings.yml
@@ -0,0 +1,9 @@
+# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ key: MyString
+ value: MyString
+
+two:
+ key: MyString
+ value: MyString
diff --git a/test/models/payment_setting_test.rb b/test/models/payment_setting_test.rb
new file mode 100644
index 0000000..4491dfe
--- /dev/null
+++ b/test/models/payment_setting_test.rb
@@ -0,0 +1,7 @@
+require "test_helper"
+
+class PaymentSettingTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end