diff --git a/app/views/credit_card_bills/_credit_card_bill.html.erb b/app/views/credit_card_bills/_credit_card_bill.html.erb index df91f34..a68153c 100644 --- a/app/views/credit_card_bills/_credit_card_bill.html.erb +++ b/app/views/credit_card_bills/_credit_card_bill.html.erb @@ -1,48 +1,149 @@ -
-

- Description: - <%= credit_card_bill.description %> -

+
+ +
+

<%= credit_card_bill.description %>

+ + +
+
+
+
+ + + +
+
+

Total Bill

+

<%= number_to_currency(credit_card_bill.amount) %>

+
+
+
+ +
+
+
+ + + +
+
+

Accounted For

+

<%= number_to_currency(Expense.credit_card_monthly_total) %>

+
+
+
+ +
+
+
+ <% if credit_card_bill.unpaid > 0 %> + + + + <% else %> + + + + <% end %> +
+
+

Unpaid Balance

+

<%= number_to_currency(credit_card_bill.unpaid) %>

+
+
+
+
+
-

- Amount: - <%= credit_card_bill.amount %> -

- -

- Accounted For: - <%= Expense.credit_card_monthly_total %> -

- -

- Unpaid: - <%= credit_card_bill.unpaid %> -

- -

- - - - - - - - - - <% Member.all.each do |member| %> - - - - + +
+
+

Member Burden Breakdown

+ + Based on unpaid amount: <%= number_to_currency(credit_card_bill.unpaid) %> + +
+ + +
MemberBurden PercentBurden Amount
<%= member.name %><%= member.burden_percent * 100 %>%<%= number_to_currency(member.burden_amount(total_amount: credit_card_bill.unpaid)) %>
+ + + + + - <% end %> - -
MemberBurden %Amount Owed
-

+ + + <% Member.all.each do |member| %> + + +
+
+ <%= member.name.first.upcase %> +
+
+

<%= member.name %>

+
+
+ + + + <%= (member.burden_percent * 100).round(1) %>% + + + + + <%= number_to_currency(member.burden_amount(total_amount: credit_card_bill.unpaid)) %> + + + + <% end %> + + +
+ + +
+ <% Member.all.each do |member| %> +
+
+
+
+ <%= member.name.first.upcase %> +
+

<%= member.name %>

+
+ + <%= (member.burden_percent * 100).round(1) %>% + +
+
+

+ <%= number_to_currency(member.burden_amount(total_amount: credit_card_bill.unpaid)) %> +

+
+
+ <% end %> +
+
+ <% if action_name != "show" %> - <%= link_to "Show this credit card bill", credit_card_bill, class: "rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> - <%= link_to 'Edit this credit card bill', edit_credit_card_bill_path(credit_card_bill), class: "rounded-lg py-3 ml-2 px-5 bg-gray-100 inline-block font-medium" %> -
+
+ <%= link_to credit_card_bill, class: "inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" do %> + + + + + View details + <% end %> + <%= link_to edit_credit_card_bill_path(credit_card_bill), class: "inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" do %> + + + + Edit bill + <% end %> +
<% end %> diff --git a/app/views/credit_card_bills/_form.html.erb b/app/views/credit_card_bills/_form.html.erb index 6098e1d..e6520a3 100644 --- a/app/views/credit_card_bills/_form.html.erb +++ b/app/views/credit_card_bills/_form.html.erb @@ -1,26 +1,75 @@ -<%= form_with(model: credit_card_bill, class: "contents") do |form| %> - <% if credit_card_bill.errors.any? %>
-

<%= pluralize(credit_card_bill.errors.count, "error") %> prohibited this credit_card_bill from being saved:

- - +<%= form_with(model: credit_card_bill, class: "space-y-6") do |form| %> + <% if credit_card_bill.errors.any? %> +
+
+
+ + + +
+
+

<%= pluralize(credit_card_bill.errors.count, "error") %> prohibited this credit card bill from being saved:

+
+
    + <% credit_card_bill.errors.each do |error| %> +
  • <%= error.full_message %>
  • + <% end %> +
+
+
+
<% end %> -
- <%= form.label :description %> - <%= form.text_field :description, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> +
+
+
+ + + +
+
+

Credit Card Bill Information

+

Enter the details for this credit card statement

+
+
+ +
+
+ <%= form.label :description, class: "block text-sm font-medium text-gray-700" %> + <%= form.text_field :description, class: "mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 sm:text-sm", placeholder: "e.g., Chase Sapphire - January 2024" %> +

A description to identify this credit card bill

+
+ +
+ <%= form.label :amount, class: "block text-sm font-medium text-gray-700" %> +
+
+ $ +
+ <%= form.text_field :amount, class: "pl-7 pr-3 py-2 block w-full border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 sm:text-sm", placeholder: "0.00" %> +
+

Total amount on the credit card statement

+
+ +
+
+
+ + + +
+

Auto-calculated unpaid amount

+

Based on total minus accounted expenses

+
+
+
+
+
-
- <%= form.label :amount %> - <%= form.text_field :amount, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> -
- -
- <%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %> +
+ <%= link_to "Cancel", credit_card_bills_path, class: "inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500" %> + <%= form.submit class: "inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 cursor-pointer" %>
<% end %> diff --git a/app/views/credit_card_bills/edit.html.erb b/app/views/credit_card_bills/edit.html.erb index ec91b94..d2ab023 100644 --- a/app/views/credit_card_bills/edit.html.erb +++ b/app/views/credit_card_bills/edit.html.erb @@ -1,8 +1,39 @@ -
-

Editing credit card bill

+
+
+ +
+ +
+

Editing credit card bill

+

Update the details for this credit card bill.

+
<%= render "form", credit_card_bill: @credit_card_bill %> - - <%= link_to "Show this credit card bill", @credit_card_bill, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> - <%= link_to "Back to credit card bills", credit_card_bills_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
diff --git a/app/views/credit_card_bills/index.html.erb b/app/views/credit_card_bills/index.html.erb index c74377d..ded8cbc 100644 --- a/app/views/credit_card_bills/index.html.erb +++ b/app/views/credit_card_bills/index.html.erb @@ -1,14 +1,155 @@ -
+
<% if notice.present? %> -

<%= notice %>

+
+

+ + + + <%= notice %> +

+
<% end %> -
-

Credit card bills

- <%= link_to 'New credit card bill', new_credit_card_bill_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %> +
+
+

Credit Card Bills

+

Track and manage your credit card expenses and member burdens

+
+ <%= link_to new_credit_card_bill_path, class: "rounded-lg py-2.5 px-4 sm:py-3 sm:px-5 bg-blue-600 hover:bg-blue-700 text-white font-medium transition-colors inline-flex items-center justify-center sm:justify-start" do %> + + + + New credit card bill + <% end %>
-
- <%= render @credit_card_bills %> -
+ <% if @credit_card_bills.any? %> + +
+
+
+
+ + + +
+
+

Total Bills

+

<%= @credit_card_bills.count %>

+
+
+
+ +
+
+
+ + + +
+
+

Total Amount

+

<%= number_to_currency(@credit_card_bills.sum(:amount)) %>

+
+
+
+ +
+
+
+ + + +
+
+

Unbudgeted

+

<%= number_to_currency(@credit_card_bills.sum(&:unpaid)) %>

+
+
+
+
+ + + + + +
+ <% @credit_card_bills.each do |bill| %> +
+
+

<%= bill.description %>

+
+ <%= link_to bill, class: "text-blue-600 hover:text-blue-800" do %> + + + + + <% end %> + <%= link_to edit_credit_card_bill_path(bill), class: "text-indigo-600 hover:text-indigo-800" do %> + + + + <% end %> +
+
+
+
+ Total Amount + <%= number_to_currency(bill.amount) %> +
+
+ Unbudgeted + <%= number_to_currency(bill.unpaid) %> +
+
+
+ <% end %> +
+ <% else %> +
+ + + +

No credit card bills

+

Get started by creating a new credit card bill.

+
+ <%= link_to new_credit_card_bill_path, class: "inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700" do %> + + + + New credit card bill + <% end %> +
+
+ <% end %>
diff --git a/app/views/credit_card_bills/new.html.erb b/app/views/credit_card_bills/new.html.erb index e0b9218..1a3208a 100644 --- a/app/views/credit_card_bills/new.html.erb +++ b/app/views/credit_card_bills/new.html.erb @@ -1,7 +1,31 @@ -
-

New credit card bill

+
+
+ +
+ +
+

New credit card bill

+

Add a new credit card bill to track member expenses and burden distribution.

+
<%= render "form", credit_card_bill: @credit_card_bill %> - - <%= link_to 'Back to credit card bills', credit_card_bills_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
diff --git a/app/views/credit_card_bills/show.html.erb b/app/views/credit_card_bills/show.html.erb index ee82a91..96db3c5 100644 --- a/app/views/credit_card_bills/show.html.erb +++ b/app/views/credit_card_bills/show.html.erb @@ -1,15 +1,60 @@ -
-
- <% if notice.present? %> -

<%= notice %>

- <% end %> - - <%= render @credit_card_bill %> - - <%= link_to 'Edit this credit card bill', edit_credit_card_bill_path(@credit_card_bill), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> -
- <%= button_to 'Destroy this credit card bill', credit_card_bill_path(@credit_card_bill), method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %> +
+ <% if notice.present? %> +
+

+ + + + <%= notice %> +

- <%= link_to 'Back to credit card bills', credit_card_bills_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> + <% end %> + +
+ +
+ + <%= render @credit_card_bill %> + +
+ <%= link_to edit_credit_card_bill_path(@credit_card_bill), class: "inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" do %> + + + + Edit credit card bill + <% end %> + + <%= button_to credit_card_bill_path(@credit_card_bill), method: :delete, form: { data: { turbo_confirm: "Are you sure you want to delete this credit card bill?" } }, class: "inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500" do %> + + + + Delete credit card bill + <% end %> + + <%= link_to credit_card_bills_path, class: "inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500" do %> + + + + Back to credit card bills + <% end %>
diff --git a/app/views/dashboard/show.html.erb b/app/views/dashboard/show.html.erb index 6cfe1bd..19ae998 100644 --- a/app/views/dashboard/show.html.erb +++ b/app/views/dashboard/show.html.erb @@ -1,70 +1,110 @@
-
- - - - - - - - - - <% @members.each do |member| %> - - - - +
+
+
MemberBurden PercentBurden Amount
<%= member.name %><%= member.burden_percent * 100 %>%<%= number_to_currency(member.burden_amount) %>
+ + + + + - <% end %> - -
MemberBurden PercentBurden Amount
+ + + <% @members.each do |member| %> + + +
<%= member.name %>
+ + + + <%= member.burden_percent * 100 %>% + + + + <%= number_to_currency(member.burden_amount) %> + + + <% end %> + + +
- - - - - - - - - - - <% @incomes.each do |income| %> - - - - - +
+
MemberForAmountIncluded
<%= income.member.name %><%= income.description %><%= number_to_currency(income.amount) %><%= income.included %>
+ + + + + + - <% end %> - -
MemberForAmountIncluded
+ + + <% @incomes.each do |income| %> + + +
<%= income.member.name %>
+ + + <%= income.description %> + + + <%= number_to_currency(income.amount) %> + + + <% if income.included %> + yes + <% else %> + no + <% end %> + + + <% end %> + + +
-
- - - - - - - - - - - - - <% @expenses.each do |expense| %> - - - - - - - +
+
+
BillPaymentPeriodMontlycredit_cardEstimated
<%= expense.description %><%= number_to_currency(expense.payment) %><%= expense.period %><%= number_to_currency(expense.monthly) %><%= expense.credit_card %><%= expense.estimated %>
+ + + + + + - <% end %> - -
BillPaymentMonthly
+ + + <% @expenses.each do |expense| %> + + +
<%= expense.description %>
+ + + <%= number_to_currency(expense.payment) %> + + + <%= number_to_currency(expense.monthly) %> + + +
+ + <%= expense.period.downcase %> + + <% if expense.credit_card %> + credit card + <% end %> + <% if expense.estimated %> + estimated + <% end %> +
+ + + <% end %> + + +
diff --git a/app/views/expenses/_expense.html.erb b/app/views/expenses/_expense.html.erb index 83e9896..2b4a868 100644 --- a/app/views/expenses/_expense.html.erb +++ b/app/views/expenses/_expense.html.erb @@ -1,32 +1,80 @@ -
-

- Description: - <%= expense.description %> -

+
+
+

<%= expense.description %>

+ +
+
+

Payment Amount

+

<%= number_to_currency(expense.payment) %>

+
+ +
+

Monthly Amount

+

<%= number_to_currency(expense.monthly) %>

+
+
+
-

- Payment: - <%= expense.payment %> -

- -

- Period: - <%= expense.period %> -

- -

- Credit card: - <%= expense.credit_card %> -

- -

- Estimated: - <%= expense.estimated %> -

+
+

Details

+
+ + + + + <%= expense.period.downcase %> + + + <% if expense.credit_card %> + + + + + + credit card + + <% else %> + + + + + bank account + + <% end %> + + <% if expense.estimated %> + + + + + estimated + + <% else %> + + + + + actual + + <% end %> +
+
<% if action_name != "show" %> - <%= link_to "Show this expense", expense, class: "rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> - <%= link_to 'Edit this expense', edit_expense_path(expense), class: "rounded-lg py-3 ml-2 px-5 bg-gray-100 inline-block font-medium" %> -
+
+ <%= link_to expense, class: "inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" do %> + + + + + View details + <% end %> + <%= link_to edit_expense_path(expense), class: "inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" do %> + + + + Edit expense + <% end %> +
<% end %>
diff --git a/app/views/expenses/_form.html.erb b/app/views/expenses/_form.html.erb index 766faec..9ec09c6 100644 --- a/app/views/expenses/_form.html.erb +++ b/app/views/expenses/_form.html.erb @@ -1,47 +1,103 @@ -<%= form_with(model: expense, class: "contents") do |form| %> +<%= form_with(model: expense, class: "space-y-6") do |form| %> <% if expense.errors.any? %> -
-

<%= pluralize(expense.errors.count, "error") %> prohibited this expense from being saved:

- -
    - <% expense.errors.each do |error| %> -
  • <%= error.full_message %>
  • - <% end %> -
+
+
+
+ + + +
+
+

<%= pluralize(expense.errors.count, "error") %> prohibited this expense from being saved:

+
+
    + <% expense.errors.each do |error| %> +
  • <%= error.full_message %>
  • + <% end %> +
+
+
+
<% end %> -
- <%= form.label :description %> - <%= form.text_field :description, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> +
+

Expense Information

+ +
+
+ <%= form.label :description, class: "block text-sm font-medium text-gray-700" %> + <%= form.text_field :description, class: "mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 sm:text-sm", placeholder: "e.g., Netflix subscription" %> +

A brief description of the expense

+
+ +
+ <%= form.label :payment, class: "block text-sm font-medium text-gray-700" %> +
+
+ $ +
+ <%= form.text_field :payment, class: "pl-7 pr-3 py-2 block w-full border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 sm:text-sm", placeholder: "0.00" %> +
+

The payment amount for this billing period

+
+ +
+ <%= form.label :period, class: "block text-sm font-medium text-gray-700" %> + <%= + form.select :period, + options_for_select(expense_periods, expense.period), + {}, + class: "mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 sm:text-sm" + %> +

How often this expense is billed

+
+
-
- <%= form.label :payment %> - <%= form.text_field :payment, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> +
+

Payment Details

+ +
+
+
+ +

This expense is paid by credit card

+
+
+ <%= form.check_box :credit_card, class: "toggle-checkbox sr-only" %> + +
+
+ +
+
+ +

This amount is an estimate

+
+
+ <%= form.check_box :estimated, class: "toggle-checkbox sr-only" %> + +
+
+
+ + -
- <%= form.label :period %> - <%= - form.select :period, - options_for_select(expense_periods, expense.period), - {}, - class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" - %> -
- -
- <%= form.label :credit_card %> - <%= form.check_box :credit_card, class: "block mt-2 h-5 w-5" %> -
- -
- <%= form.label :estimated %> - <%= form.check_box :estimated, class: "block mt-2 h-5 w-5" %> -
- -
- <%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %> +
+ <%= link_to "Cancel", expenses_path, class: "inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500" %> + <%= form.submit class: "inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 cursor-pointer" %>
<% end %> diff --git a/app/views/expenses/edit.html.erb b/app/views/expenses/edit.html.erb index f5db8f0..dc50764 100644 --- a/app/views/expenses/edit.html.erb +++ b/app/views/expenses/edit.html.erb @@ -1,8 +1,39 @@ -
-

Editing expense

+
+
+ +
+ +
+

Editing expense

+

Update the details for this expense.

+
<%= render "form", expense: @expense %> - - <%= link_to "Show this expense", @expense, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> - <%= link_to "Back to expenses", expenses_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
diff --git a/app/views/expenses/index.html.erb b/app/views/expenses/index.html.erb index 3008610..983f8aa 100644 --- a/app/views/expenses/index.html.erb +++ b/app/views/expenses/index.html.erb @@ -1,14 +1,130 @@ -
+
<% if notice.present? %> -

<%= notice %>

+
+

+ + + + <%= notice %> +

+
<% end %> -
-

Expenses

- <%= link_to 'New expense', new_expense_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %> +
+

Expenses

+ <%= link_to new_expense_path, class: "rounded-lg py-2.5 px-4 sm:py-3 sm:px-5 bg-blue-600 hover:bg-blue-700 text-white font-medium transition-colors flex items-center" do %> + + + + New expense + <% end %>
-
- <%= render @expenses %> -
+ <% if @expenses.any? %> + + +
+ <% @expenses.each do |expense| %> +
+
+

<%= expense.description %>

+
+ <%= link_to expense, class: "text-blue-600 hover:text-blue-800" do %> + + + + + <% end %> + <%= link_to edit_expense_path(expense), class: "text-indigo-600 hover:text-indigo-800" do %> + + + + <% end %> +
+
+
+
+

Payment

+

<%= number_to_currency(expense.payment) %>

+
+
+

Monthly

+

<%= number_to_currency(expense.monthly) %>

+
+
+
+ + <%= expense.period.downcase %> + + <% if expense.credit_card %> + credit card + <% end %> + <% if expense.estimated %> + estimated + <% end %> +
+
+ <% end %> +
+ <% else %> +
+ + + +

No expenses

+

Get started by creating a new expense.

+
+ <%= link_to new_expense_path, class: "inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700" do %> + + + + New expense + <% end %> +
+
+ <% end %>
diff --git a/app/views/expenses/new.html.erb b/app/views/expenses/new.html.erb index 5afd7be..b40b8e5 100644 --- a/app/views/expenses/new.html.erb +++ b/app/views/expenses/new.html.erb @@ -1,7 +1,31 @@ -
-

New expense

+
+
+ +
+ +
+

New expense

+

Add a new recurring expense to track your spending.

+
<%= render "form", expense: @expense %> - - <%= link_to 'Back to expenses', expenses_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
diff --git a/app/views/expenses/show.html.erb b/app/views/expenses/show.html.erb index e4a6db3..288bf1a 100644 --- a/app/views/expenses/show.html.erb +++ b/app/views/expenses/show.html.erb @@ -1,15 +1,60 @@ -
-
- <% if notice.present? %> -

<%= notice %>

- <% end %> - - <%= render @expense %> - - <%= link_to 'Edit this expense', edit_expense_path(@expense), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> -
- <%= button_to 'Destroy this expense', expense_path(@expense), method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %> +
+ <% if notice.present? %> +
+

+ + + + <%= notice %> +

- <%= link_to 'Back to expenses', expenses_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> + <% end %> + +
+ +
+ + <%= render @expense %> + +
+ <%= link_to edit_expense_path(@expense), class: "inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" do %> + + + + Edit expense + <% end %> + + <%= button_to expense_path(@expense), method: :delete, form: { data: { turbo_confirm: "Are you sure you want to delete this expense?" } }, class: "inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500" do %> + + + + Delete expense + <% end %> + + <%= link_to expenses_path, class: "inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500" do %> + + + + Back to expenses + <% end %>
diff --git a/app/views/incomes/_form.html.erb b/app/views/incomes/_form.html.erb index ae19b6d..fcd9c4b 100644 --- a/app/views/incomes/_form.html.erb +++ b/app/views/incomes/_form.html.erb @@ -1,9 +1,13 @@ -<%= form_with(model: income, class: "contents") do |form| %> +<%= form_with(model: income, class: "space-y-8") do |form| %> <% if income.errors.any? %> -
-

<%= pluralize(income.errors.count, "error") %> prohibited this income from being saved:

- -
    +
    +
    + + + +

    <%= pluralize(income.errors.count, "error") %> prohibited this income from being saved:

    +
    +
      <% income.errors.each do |error| %>
    • <%= error.full_message %>
    • <% end %> @@ -11,32 +15,74 @@
    <% end %> -
    - <%= form.label :description %> - <%= form.text_field :description, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> + +
    +

    Basic Information

    + +
    +
    + <%= form.label :description, class: "block text-sm font-medium text-gray-700 mb-2" %> + <%= form.text_field :description, + class: "block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm", + placeholder: "Enter income description..." %> +
    + +
    + <%= form.label :amount, class: "block text-sm font-medium text-gray-700 mb-2" %> +
    +
    + $ +
    + <%= form.number_field :amount, + class: "block w-full pl-7 pr-3 py-2 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm font-mono", + placeholder: "0.00", + step: "0.01", + min: "0" %> +
    +
    + +
    + <%= form.label :member_id, "Member", class: "block text-sm font-medium text-gray-700 mb-2" %> + <%= form.select :member_id, + options_for_select(members, income.member_id), + { prompt: "Select a member..." }, + class: "block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm" %> +
    +
    -
    - <%= form.label :included %> - <%= form.check_box :included, class: "block mt-2 h-5 w-5" %> + +
    +

    Budget Settings

    + +
    +
    + <%= form.label :included, "Include in Budget", class: "block text-sm font-medium text-gray-700" %> +

    Whether this income should be included in budget calculations

    +
    +
    + <%= form.check_box :included, class: "toggle-checkbox sr-only" %> + +
    +
    -
    - <%= form.label :amount %> - <%= form.text_field :amount, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> + +
    + <%= link_to incomes_path, class: "inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" do %> + Cancel + <% end %> + <%= form.submit class: "inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 cursor-pointer" %>
    -
    - <%= form.label :member_id %> - <%= - form.select :member_id, - options_for_select(members, income.member_id), - {}, - class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" - %> -
    - -
    - <%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %> -
    + <% end %> diff --git a/app/views/incomes/_income.html.erb b/app/views/incomes/_income.html.erb index e283a1f..e6e47a7 100644 --- a/app/views/incomes/_income.html.erb +++ b/app/views/incomes/_income.html.erb @@ -1,27 +1,49 @@ -
    -

    - Description: - <%= income.description %> -

    +
    +
    +
    +

    <%= income.description %>

    + <% if income.included %> + included + <% else %> + excluded + <% end %> +
    + +
    +
    +
    + <%= income.member.name.first.upcase %> +
    +
    +

    <%= income.member.name %>

    +

    Member

    +
    +
    + +
    +
    +

    <%= number_to_currency(income.amount) %>

    +

    Amount

    +
    +
    +
    -

    - Included: - <%= income.included %> -

    - -

    - Amount: - <%= income.amount %> -

    - -

    - Member: - <%= income.member_id %> -

    - - <% if action_name != "show" %> - <%= link_to "Show this income", income, class: "rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> - <%= link_to 'Edit this income', edit_income_path(income), class: "rounded-lg py-3 ml-2 px-5 bg-gray-100 inline-block font-medium" %> -
    - <% end %> + <% if action_name != "show" %> +
    + <%= link_to income, class: "flex-1 inline-flex items-center justify-center px-4 py-2 text-sm font-medium text-blue-600 bg-blue-50 hover:bg-blue-100 rounded-md transition-colors" do %> + + + + + View + <% end %> + <%= link_to edit_income_path(income), class: "flex-1 inline-flex items-center justify-center px-4 py-2 text-sm font-medium text-indigo-600 bg-indigo-50 hover:bg-indigo-100 rounded-md transition-colors" do %> + + + + Edit + <% end %> +
    + <% end %> +
    diff --git a/app/views/incomes/edit.html.erb b/app/views/incomes/edit.html.erb index 237e85f..678d7d6 100644 --- a/app/views/incomes/edit.html.erb +++ b/app/views/incomes/edit.html.erb @@ -1,8 +1,42 @@ -
    -

    Editing income

    +
    + + - <%= render "form", income: @income %> +
    +
    +

    Edit Income

    +

    Update the details for "<%= @income.description %>"

    +
    - <%= link_to "Show this income", @income, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> - <%= link_to "Back to incomes", incomes_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> + <%= render "form", income: @income %> +
    diff --git a/app/views/incomes/index.html.erb b/app/views/incomes/index.html.erb index 2fb3cb5..1fb6989 100644 --- a/app/views/incomes/index.html.erb +++ b/app/views/incomes/index.html.erb @@ -1,14 +1,193 @@ -
    +
    <% if notice.present? %> -

    <%= notice %>

    +
    +

    + + + + <%= notice %> +

    +
    <% end %> -
    -

    Incomes

    - <%= link_to 'New income', new_income_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %> +
    +
    +

    Incomes

    +

    Track member income sources and budget allocations

    +
    + <%= link_to new_income_path, class: "rounded-lg py-2.5 px-4 sm:py-3 sm:px-5 bg-blue-600 hover:bg-blue-700 text-white font-medium transition-colors inline-flex items-center justify-center sm:justify-start" do %> + + + + New income + <% end %>
    -
    - <%= render @incomes %> -
    + <% if @incomes.any? %> + +
    +
    +
    +
    + + + +
    +
    +

    Total Sources

    +

    <%= @incomes.count %>

    +
    +
    +
    + +
    +
    +
    + + + +
    +
    +

    Total Income

    +

    <%= number_to_currency(@incomes.sum(:amount)) %>

    +
    +
    +
    + +
    +
    +
    + + + +
    +
    +

    Included

    +

    <%= number_to_currency(@incomes.where(included: true).sum(:amount)) %>

    +
    +
    +
    + +
    +
    +
    + + + +
    +
    +

    Excluded

    +

    <%= number_to_currency(@incomes.where(included: false).sum(:amount)) %>

    +
    +
    +
    +
    + + + + + +
    + <% @incomes.each do |income| %> +
    +
    +

    <%= income.description %>

    +
    + <%= link_to income, class: "text-blue-600 hover:text-blue-800" do %> + + + + + <% end %> + <%= link_to edit_income_path(income), class: "text-indigo-600 hover:text-indigo-800" do %> + + + + <% end %> +
    +
    +
    +
    +
    +
    + <%= income.member.name.first.upcase %> +
    + <%= income.member.name %> +
    + <%= number_to_currency(income.amount) %> +
    +
    + Budget Status + <% if income.included %> + included + <% else %> + excluded + <% end %> +
    +
    +
    + <% end %> +
    + <% else %> +
    + + + +

    No income sources

    +

    Get started by adding your first income source.

    +
    + <%= link_to new_income_path, class: "inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700" do %> + + + + New income + <% end %> +
    +
    + <% end %>
    diff --git a/app/views/incomes/new.html.erb b/app/views/incomes/new.html.erb index a923909..ba44c0c 100644 --- a/app/views/incomes/new.html.erb +++ b/app/views/incomes/new.html.erb @@ -1,7 +1,32 @@ -
    -

    New income

    +
    + + - <%= render "form", income: @income %> +
    +
    +

    New Income

    +

    Add a new income source to your budget

    +
    - <%= link_to 'Back to incomes', incomes_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> + <%= render "form", income: @income %> +
    diff --git a/app/views/incomes/show.html.erb b/app/views/incomes/show.html.erb index c1a5e7a..7df058c 100644 --- a/app/views/incomes/show.html.erb +++ b/app/views/incomes/show.html.erb @@ -1,15 +1,110 @@ -
    -
    - <% if notice.present? %> -

    <%= notice %>

    - <% end %> - - <%= render @income %> - - <%= link_to 'Edit this income', edit_income_path(@income), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> -
    - <%= button_to 'Destroy this income', income_path(@income), method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %> +
    + <% if notice.present? %> +
    +

    + + + + <%= notice %> +

    +
    + <% end %> + + + + +
    +
    +
    +
    +

    <%= @income.description %>

    +

    Income source details and budget allocation

    +
    + <% if @income.included %> + + + + + included + + <% else %> + + + + + excluded + + <% end %> +
    +
    + + +
    +
    +
    + +
    +
    + <%= @income.member.name.first.upcase %> +
    +
    +

    Member

    +

    <%= @income.member.name %>

    +
    +
    + + +
    +

    Amount

    +

    <%= number_to_currency(@income.amount) %>

    +
    +
    +
    +
    + + +
    + <%= link_to edit_income_path(@income), class: "inline-flex items-center px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors" do %> + + + + Edit Income + <% end %> + + <%= button_to income_path(@income), method: :delete, + class: "inline-flex items-center px-4 py-2 bg-red-600 hover:bg-red-700 text-white font-medium rounded-lg transition-colors", + confirm: "Are you sure you want to delete this income source?" do %> + + + + Delete + <% end %> + + <%= link_to incomes_path, class: "inline-flex items-center px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-medium rounded-lg transition-colors" do %> + + + + Back to Incomes + <% end %>
    - <%= link_to 'Back to incomes', incomes_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
    diff --git a/app/views/members/_form.html.erb b/app/views/members/_form.html.erb index 80b6a55..ab8ddf4 100644 --- a/app/views/members/_form.html.erb +++ b/app/views/members/_form.html.erb @@ -1,9 +1,13 @@ -<%= form_with(model: member, class: "contents") do |form| %> +<%= form_with(model: member, class: "space-y-8") do |form| %> <% if member.errors.any? %> -
    -

    <%= pluralize(member.errors.count, "error") %> prohibited this member from being saved:

    - -
      +
      +
      + + + +

      <%= pluralize(member.errors.count, "error") %> prohibited this member from being saved:

      +
      +
        <% member.errors.each do |error| %>
      • <%= error.full_message %>
      • <% end %> @@ -11,17 +15,52 @@
      <% end %> -
      - <%= form.label :name %> - <%= form.text_field :name, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> + +
      +

      Basic Information

      + +
      +
      + <%= form.label :name, class: "block text-sm font-medium text-gray-700 mb-2" %> + <%= form.text_field :name, + class: "block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm", + placeholder: "Enter member name..." %> +
      +
      -
      - <%= form.label :pays %> - <%= form.check_box :pays, class: "block mt-2 h-5 w-5" %> + +
      +

      Budget Role

      + +
      +
      + <%= form.label :pays, "Contributing Member", class: "block text-sm font-medium text-gray-700" %> +

      Whether this member contributes financially to the household budget

      +
      +
      + <%= form.check_box :pays, class: "toggle-checkbox sr-only" %> + +
      +
      -
      - <%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %> + +
      + <%= link_to members_path, class: "inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" do %> + Cancel + <% end %> + <%= form.submit class: "inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 cursor-pointer" %>
      + + <% end %> diff --git a/app/views/members/_member.html.erb b/app/views/members/_member.html.erb index 080783d..463db79 100644 --- a/app/views/members/_member.html.erb +++ b/app/views/members/_member.html.erb @@ -1,17 +1,48 @@ -
      -

      - Name: - <%= member.name %> -

      +
      +
      +
      +
      +
      + <%= member.name.first.upcase %> +
      +
      +

      <%= member.name %>

      +

      Household Member

      +
      +
      + <% if member.pays %> + + + + + contributing + + <% else %> + + + + + non-contributing + + <% end %> +
      -

      - Pays: - <%= member.pays %> -

      - - <% if action_name != "show" %> - <%= link_to "Show this member", member, class: "rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> - <%= link_to 'Edit this member', edit_member_path(member), class: "rounded-lg py-3 ml-2 px-5 bg-gray-100 inline-block font-medium" %> -
      - <% end %> + <% if action_name != "show" %> +
      + <%= link_to member, class: "flex-1 inline-flex items-center justify-center px-4 py-2 text-sm font-medium text-blue-600 bg-blue-50 hover:bg-blue-100 rounded-md transition-colors" do %> + + + + + View + <% end %> + <%= link_to edit_member_path(member), class: "flex-1 inline-flex items-center justify-center px-4 py-2 text-sm font-medium text-indigo-600 bg-indigo-50 hover:bg-indigo-100 rounded-md transition-colors" do %> + + + + Edit + <% end %> +
      + <% end %> +
      diff --git a/app/views/members/edit.html.erb b/app/views/members/edit.html.erb index 27ef21d..61b9ae2 100644 --- a/app/views/members/edit.html.erb +++ b/app/views/members/edit.html.erb @@ -1,8 +1,42 @@ -
      -

      Editing member

      +
      + + - <%= render "form", member: @member %> +
      +
      +

      Edit Member

      +

      Update the details for "<%= @member.name %>"

      +
      - <%= link_to "Show this member", @member, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> - <%= link_to "Back to members", members_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> + <%= render "form", member: @member %> +
      diff --git a/app/views/members/index.html.erb b/app/views/members/index.html.erb index b66a805..ded8cd1 100644 --- a/app/views/members/index.html.erb +++ b/app/views/members/index.html.erb @@ -1,14 +1,164 @@ -
      +
      <% if notice.present? %> -

      <%= notice %>

      +
      +

      + + + + <%= notice %> +

      +
      <% end %> -
      -

      Members

      - <%= link_to 'New member', new_member_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %> +
      +
      +

      Members

      +

      Manage household members and their budget roles

      +
      + <%= link_to new_member_path, class: "rounded-lg py-2.5 px-4 sm:py-3 sm:px-5 bg-blue-600 hover:bg-blue-700 text-white font-medium transition-colors inline-flex items-center justify-center sm:justify-start" do %> + + + + New member + <% end %>
      -
      - <%= render @members %> -
      + <% if @members.any? %> + +
      +
      +
      +
      + + + +
      +
      +

      Total Members

      +

      <%= @members.count %>

      +
      +
      +
      + +
      +
      +
      + + + +
      +
      +

      Contributing

      +

      <%= @members.where(pays: true).count %>

      +
      +
      +
      + +
      +
      +
      + + + +
      +
      +

      Non-Contributing

      +

      <%= @members.where(pays: false).count %>

      +
      +
      +
      +
      + + + + + +
      + <% @members.each do |member| %> +
      +
      +
      +
      + <%= member.name.first.upcase %> +
      +
      +

      <%= member.name %>

      + <% if member.pays %> + contributing + <% else %> + non-contributing + <% end %> +
      +
      +
      + <%= link_to member, class: "text-blue-600 hover:text-blue-800" do %> + + + + + <% end %> + <%= link_to edit_member_path(member), class: "text-indigo-600 hover:text-indigo-800" do %> + + + + <% end %> +
      +
      +
      + <% end %> +
      + <% else %> +
      + + + +

      No members

      +

      Get started by adding your first household member.

      +
      + <%= link_to new_member_path, class: "inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700" do %> + + + + New member + <% end %> +
      +
      + <% end %>
      diff --git a/app/views/members/new.html.erb b/app/views/members/new.html.erb index 2ab9003..d11f6c1 100644 --- a/app/views/members/new.html.erb +++ b/app/views/members/new.html.erb @@ -1,7 +1,32 @@ -
      -

      New member

      +
      + + - <%= render "form", member: @member %> +
      +
      +

      New Member

      +

      Add a new household member and set their budget role

      +
      - <%= link_to 'Back to members', members_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> + <%= render "form", member: @member %> +
      diff --git a/app/views/members/show.html.erb b/app/views/members/show.html.erb index f925386..ff9aff4 100644 --- a/app/views/members/show.html.erb +++ b/app/views/members/show.html.erb @@ -1,15 +1,118 @@ -
      -
      - <% if notice.present? %> -

      <%= notice %>

      - <% end %> - - <%= render @member %> - - <%= link_to 'Edit this member', edit_member_path(@member), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %> -
      - <%= button_to 'Destroy this member', member_path(@member), method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %> +
      + <% if notice.present? %> +
      +

      + + + + <%= notice %> +

      +
      + <% end %> + + + + +
      +
      +
      +
      +

      <%= @member.name %>

      +

      Household member details and budget role

      +
      + <% if @member.pays %> + + + + + contributing + + <% else %> + + + + + non-contributing + + <% end %> +
      +
      + + +
      +
      +
      +
      +
      + <%= @member.name.first.upcase %> +
      +

      <%= @member.name %>

      +

      Household Member

      +
      + <% if @member.pays %> +
      + + + + Contributing to budget +
      + <% else %> +
      + + + + Not contributing to budget +
      + <% end %> +
      +
      +
      +
      +
      + + +
      + <%= link_to edit_member_path(@member), class: "inline-flex items-center px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors" do %> + + + + Edit Member + <% end %> + + <%= button_to member_path(@member), method: :delete, + class: "inline-flex items-center px-4 py-2 bg-red-600 hover:bg-red-700 text-white font-medium rounded-lg transition-colors", + confirm: "Are you sure you want to delete this member?" do %> + + + + Delete + <% end %> + + <%= link_to members_path, class: "inline-flex items-center px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 font-medium rounded-lg transition-colors" do %> + + + + Back to Members + <% end %>
      - <%= link_to 'Back to members', members_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
      diff --git a/test/system/credit_card_bills_test.rb b/test/system/credit_card_bills_test.rb index 0f1dbde..5c829c8 100644 --- a/test/system/credit_card_bills_test.rb +++ b/test/system/credit_card_bills_test.rb @@ -8,7 +8,7 @@ class CreditCardBillsTest < ApplicationSystemTestCase test "visiting the index" do visit credit_card_bills_url - assert_selector "h1", text: "Credit card bills" + assert_selector "h1", text: "Credit Card Bills" end test "should create credit card bill" do @@ -25,7 +25,7 @@ class CreditCardBillsTest < ApplicationSystemTestCase test "should update Credit card bill" do visit credit_card_bill_url(@credit_card_bill) - click_on "Edit this credit card bill", match: :first + click_on "Edit credit card bill", match: :first fill_in "Amount", with: @credit_card_bill.amount fill_in "Description", with: @credit_card_bill.description @@ -37,7 +37,7 @@ class CreditCardBillsTest < ApplicationSystemTestCase test "should destroy Credit card bill" do visit credit_card_bill_url(@credit_card_bill) - click_on "Destroy this credit card bill", match: :first + click_on "Delete credit card bill", match: :first assert_text "Credit card bill was successfully destroyed" end diff --git a/test/system/expenses_test.rb b/test/system/expenses_test.rb index b4a979a..d23f851 100644 --- a/test/system/expenses_test.rb +++ b/test/system/expenses_test.rb @@ -15,7 +15,9 @@ class ExpensesTest < ApplicationSystemTestCase visit expenses_url click_on "New expense" - check "Credit card" if @expense.credit_card + if @expense.credit_card + find("label.toggle-label[for='expense_credit_card']").click + end fill_in "Description", with: @expense.description check "Estimated" if @expense.estimated fill_in "Payment", with: @expense.payment @@ -28,9 +30,11 @@ class ExpensesTest < ApplicationSystemTestCase test "should update Expense" do visit expense_url(@expense) - click_on "Edit this expense", match: :first + click_on "Edit expense", match: :first - check "Credit card" if @expense.credit_card + if @expense.credit_card + find("label.toggle-label[for='expense_credit_card']").click + end fill_in "Description", with: @expense.description check "Estimated" if @expense.estimated fill_in "Payment", with: @expense.payment @@ -43,7 +47,7 @@ class ExpensesTest < ApplicationSystemTestCase test "should destroy Expense" do visit expense_url(@expense) - click_on "Destroy this expense", match: :first + click_on "Delete expense", match: :first assert_text "Expense was successfully destroyed" end diff --git a/test/system/incomes_test.rb b/test/system/incomes_test.rb index 0ae4e55..23f1442 100644 --- a/test/system/incomes_test.rb +++ b/test/system/incomes_test.rb @@ -17,7 +17,9 @@ class IncomesTest < ApplicationSystemTestCase fill_in "Amount", with: @income.amount fill_in "Description", with: @income.description - check "Included" if @income.included + if @income.included + find("label.toggle-label[for='income_included']").click + end select @income.member.name, from: "Member" click_on "Create Income" @@ -27,11 +29,13 @@ class IncomesTest < ApplicationSystemTestCase test "should update Income" do visit income_url(@income) - click_on "Edit this income", match: :first + click_on "Edit Income", match: :first fill_in "Amount", with: @income.amount fill_in "Description", with: @income.description - check "Included" if @income.included + if @income.included + find("label.toggle-label[for='income_included']").click + end select @income.member.name, from: "Member" click_on "Update Income" @@ -41,7 +45,7 @@ class IncomesTest < ApplicationSystemTestCase test "should destroy Income" do visit income_url(@income) - click_on "Destroy this income", match: :first + click_on "Delete", match: :first assert_text "Income was successfully destroyed" end diff --git a/test/system/members_test.rb b/test/system/members_test.rb index fca56bb..94abcd3 100644 --- a/test/system/members_test.rb +++ b/test/system/members_test.rb @@ -25,7 +25,7 @@ class MembersTest < ApplicationSystemTestCase test "should update Member" do visit member_url(@member) - click_on "Edit this member", match: :first + click_on "Edit Member", match: :first fill_in "Name", with: @member.name check "Pays" if @member.pays @@ -37,7 +37,7 @@ class MembersTest < ApplicationSystemTestCase test "should destroy Member" do visit member_url(@member) - click_on "Destroy this member", match: :first + click_on "Delete", match: :first assert_text "Member was successfully destroyed" end