Hook up a customer-specific time entries list in the customer form view

This commit is contained in:
Paul van Tilburg 2015-06-19 21:41:22 +02:00
parent 7a1d18269a
commit 55e18615e4
1 changed files with 15 additions and 0 deletions

View File

@ -1014,10 +1014,17 @@ module StopTime::Controllers
end
end
@time_entries = @customer.time_entries.order("start DESC")
@invoices = @customer.invoices
@invoices.each do |i|
@input["paid_#{i.number}"] = true if i.paid?
end
@task_list = Hash.new { |h, k| h[k] = Array.new }
@customer.tasks.reject { |t| t.billed? }.each do |t|
@task_list[t.customer.shortest_name] << [t.id, t.name]
end
@input["bill"] = true # Bill by default.
@input["task"] = @time_entries.first.task.id if @time_entries.present?
@target = [CustomersN, @customer.id]
@button = "update"
@ -2146,6 +2153,14 @@ module StopTime::Views
end
end
end
div.row do
div.span12 do
# Show registered time (ab)using the time_entries view as partial view.
h2 "Registered time"
_time_entries(@customer) unless @method == "create"
end
end
end
# Form for updating the properties of a task ({Models::Task}).