Hook up a customer-specific time entries list in the customer form view
This commit is contained in:
parent
7a1d18269a
commit
55e18615e4
15
stoptime.rb
15
stoptime.rb
|
@ -1014,10 +1014,17 @@ module StopTime::Controllers
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@time_entries = @customer.time_entries.order("start DESC")
|
||||||
@invoices = @customer.invoices
|
@invoices = @customer.invoices
|
||||||
@invoices.each do |i|
|
@invoices.each do |i|
|
||||||
@input["paid_#{i.number}"] = true if i.paid?
|
@input["paid_#{i.number}"] = true if i.paid?
|
||||||
end
|
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]
|
@target = [CustomersN, @customer.id]
|
||||||
@button = "update"
|
@button = "update"
|
||||||
|
@ -2146,6 +2153,14 @@ module StopTime::Views
|
||||||
end
|
end
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
# Form for updating the properties of a task ({Models::Task}).
|
# Form for updating the properties of a task ({Models::Task}).
|
||||||
|
|
Loading…
Reference in New Issue