Skip to content

Commit

Permalink
Merge branch 'develop' into holidays-calendar-view
Browse files Browse the repository at this point in the history
  • Loading branch information
apoorv1316 authored Oct 17, 2023
2 parents 313b273 + 3f3ce8c commit b4ca426
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/internal_api/v1/clients_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def show
project_details: client.project_details(params[:time_frame]),
total_minutes: client.total_hours_logged(params[:time_frame]),
overdue_outstanding_amount: client.client_overdue_and_outstanding_calculation,
invoices: client.invoices,
invoices: client.invoices.includes([:company]),
invitations: client.invitations,
client_members_emails: client.client_members.joins(:user).pluck("users.email")
},
Expand Down
4 changes: 4 additions & 0 deletions app/models/invoice_line_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,8 @@ def time_spent
def total_cost
@_total_cost ||= (hours_spent * rate).round(3)
end

def formatted_date
CompanyDateFormattingService.new(date, company: invoice.company).process
end
end
2 changes: 1 addition & 1 deletion app/presenters/invoice_line_item_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(invoice_line_item)
def pdf_row(base_currency)
{
name: invoice_line_item.name,
date: invoice_line_item.date,
date: invoice_line_item.formatted_date,
description: invoice_line_item.description,
quantity: invoice_line_item.time_spent,
rate: FormatAmountService.new(base_currency, invoice_line_item.rate).process,
Expand Down
6 changes: 3 additions & 3 deletions app/views/pdfs/invoices.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ html {
<div class="w-1/4">
<p class="font-normal text-xs text-miru-dark-purple-1000 flex">Date of Issue</p>
<p class="font-normal text-base text-miru-dark-purple-1000">
<%=invoice["issue_date"].strftime('%d-%m-%Y')%>
<%= invoice.formatted_issue_date %>
</p>
<p class="font-normal text-xs text-miru-dark-purple-1000 mt-4">Due Date</p>
<p class="font-normal text-base text-miru-dark-purple-1000">
<%=invoice["due_date"].strftime('%d-%m-%Y')%>
<%= invoice.formatted_due_date %>
</p>
</div>
<div class="w-1/3">
Expand Down Expand Up @@ -83,7 +83,7 @@ html {
<%invoice_line_items.each do |item| %>
<tr>
<td class="border-b-2 border-miru-gray-200 px-1 py-3 font-normal text-base text-miru-dark-purple-1000 text-left "><%=item[:name]%></td>
<td class="border-b-2 border-miru-gray-200 py-3 font-normal text-base text-miru-dark-purple-1000 text-left"><%=item[:date].strftime('%d-%m-%Y')%></td>
<td class="border-b-2 border-miru-gray-200 py-3 font-normal text-base text-miru-dark-purple-1000 text-left"><%=item[:date]%></td>
<td class="border-b-2 border-miru-gray-200 px-1 pl-2 py-3 font-normal text-base text-miru-dark-purple-1000 text-left ">
<%=item[:description]%>
</td>
Expand Down

0 comments on commit b4ca426

Please sign in to comment.