-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
payment and forms refined with required fields
- Loading branch information
Showing
27 changed files
with
413 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module Admin::PaymentSettingsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# app/models/payment_setting.rb | ||
class PaymentSetting < ApplicationRecord | ||
validates :key, presence: true, uniqueness: true | ||
validates :value, presence: true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- app/views/admin/payment_settings/edit.html.erb --> | ||
<h1>Payment Settings</h1> | ||
|
||
<%= form_with(model: @payment_setting, url: admin_payment_setting_path, local: true) do |form| %> | ||
<div class="mb-3"> | ||
<%= form.label :value, "Membership Registration Fee (GHC)" %> | ||
<%= form.text_field :value, class: "form-control" %> | ||
</div> | ||
|
||
<div class="actions"> | ||
<%= form.submit "Update Settings", class: "btn btn-primary" %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!-- app/views/admin/payment_settings/index.html.erb --> | ||
<h1>Payment Settings</h1> | ||
|
||
<% if @payment_settings.present? %> | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>Key</th> | ||
<th>Value</th> | ||
<th>Actions</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @payment_settings.each do |setting| %> | ||
<tr> | ||
<td><%= setting.key %></td> | ||
<td><%= setting.value %></td> | ||
<td> | ||
<%= link_to 'Edit', edit_admin_payment_setting_path(setting), class: 'btn btn-secondary btn-sm' %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
<% else %> | ||
<p>No payment settings found.</p> | ||
<% end %> | ||
|
||
<%= link_to 'Back', admin_root_path, class: 'btn btn-secondary mt-3' %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,59 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<meta charset="utf-8"> | ||
<meta name="description" content="Your application description"> | ||
|
||
<title>FLMS</title> | ||
<%= csrf_meta_tags %> | ||
<%= csp_meta_tag %> | ||
|
||
<link rel="icon" href="/icon.svg" type="image/svg+xml"> | ||
<link rel="apple-touch-icon" href="/icon.png"> | ||
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> | ||
<%= javascript_importmap_tags %> | ||
<script src="https://checkout.flutterwave.com/v3.js"></script> | ||
</head> | ||
|
||
<body> | ||
<%= yield %> | ||
</body> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<meta name="description" content="Your application description"> | ||
|
||
<title>FLMS</title> | ||
<%= csrf_meta_tags %> | ||
<%= csp_meta_tag %> | ||
|
||
<link rel="icon" href="/icon.svg" type="image/svg+xml"> | ||
<link rel="apple-touch-icon" href="/icon.png"> | ||
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> | ||
|
||
<!-- Bootstrap CSS --> | ||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous"> | ||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet"> | ||
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css"> | ||
|
||
<%= javascript_importmap_tags %> | ||
<script src="https://checkout.flutterwave.com/v3.js"></script> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/@rails/ujs@7.0.4/lib/assets/compiled/rails-ujs.js"></script> | ||
</head> | ||
|
||
<body> | ||
<% if user_signed_in? && current_user.user? %> | ||
<!-- Navbar for Users --> | ||
<nav class="navbar navbar-expand-lg navbar-light bg-light"> | ||
<div class="container-fluid"> | ||
<a class="navbar-brand" href="#">FLMS</a> | ||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
<div class="collapse navbar-collapse" id="navbarNav"> | ||
<ul class="navbar-nav me-auto mb-2 mb-lg-0"> | ||
<li class="nav-item"> | ||
<%= link_to 'Home', home_path, class: 'nav-link' %> | ||
</li> | ||
<li class="nav-item"> | ||
<%= link_to 'Register Membership', new_membership_path, class: 'nav-link' %> | ||
</li> | ||
</ul> | ||
<ul class="navbar-nav"> | ||
<li class="nav-item"> | ||
<%= link_to 'Sign out', destroy_user_session_path, method: :delete, class: 'nav-link' %> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</nav> | ||
<% end %> | ||
|
||
<%= yield %> <!-- Main content of the page will be rendered here --> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.